2. Chapter 2 Data Types and Arrays - compscisi/Programming-Fundamentals-1-SI GitHub Wiki
Special Characters
Character | Name | Meaning |
---|---|---|
// | Double Slash | Beginning of a comment |
# | Pound sign | Beginning of preprocessor |
< > | Open/close brackets | Enclose filename in #include |
( ) | Open/close Parentheses | Used when naming a function |
{ } | Open/close brace | Encloses a group of statements |
" " | Open/close Quotation marks | Encloses string of characters |
; | Semicolon | End of a programming statement |
Some Key Terms
- cout: Displays output on the computer screen
- endl: Starts a new line
- \n: Also starts a new line
- float: single precision - 1.000000
- double: double precision - 1.00000000000000
Binary arithmetic opeators
Symbol | Operation |
---|---|
+ | addition |
- | subtraction |
* | multiplication |
/ | division |
% | modulus(remainder) |
Arrays
- Collection of data
- Has name and data type
- Name is used to refer to the collection
- Data type is what the array is a collection of
- Declaring an array:
int numbers[10];
- Declaring an array:
- Int is type of data, numbers is the name of the array, 10 is number of integers in collection
- Accessing element of an array:
numbers[0] = 42 cout << numbers[0];
- Accessing element of an array: