Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Mathematical Operators:
- +, -, *, /, %
- int a, b, c;
- b=0;
- c=1
- a = b+c;
- Assignment operator:
- =
- a+=2; //a=a+2
- -=
- Logical Operators:
- == <= >= !=
- ! && ||
- 1,0, true, false
- Data types:
- bool true, false, 1, 0
- int -3, 1, 2. etc.
- float -3.1416, 1.01, 2.1. etc.
- char 'a', 'b', 'Z', '\n', '0'
- long int same as int but can hold bigger number
- double same as float but can hold bigger number
- void no type/ valueless
- non-primitive:
- string "I can type a word here"
- TEST TIME
- CONDITIONAL STATEMENTS
- IF
- ELSE IF
- SWITCH
- NESTED IF (Login SYSTEM)
- COMMENT
- // SINGLE LINE
- /* MULTIPLE LINES */
- VARIABLE SCOPES:
- LOCAL
- GLOBAL
- Looping statements:
- while
- do while
- for
- goto
- (What is iteration) (it's a repeatitions)
- switch(variable){
- case condition:
- break;
- case condition:
- break;
- default:
- break;
- }
- int main() {
- char cod;
- while(cod != 'x'){
- cout << "Enter CODE: ";
- cin >> cod;
- }
- return 0;
- }
- #include <iostream>
- using namespace std;
- int main(){
- char choice = 'y';
- int num;
- while(choice == 'y'){
- cout << "Enter a number: ";
- cin >> num;
- cout << "The number is: " << num << endl;
- cout << "_____________________\n";
- cout << "Type y to continue: ";
- cin >> choice;
- cout << endl;
- system("cls");
- }
- return 0;
- }
- --------------------------------------------------------------
- Jump Statements:
- break (stop loop)
- continue (skip)
- return (stop the function)
- goto (jump)
- USING LOOP TO PRINT NUMBERS
- USING LOOP TO PRINT TRIANGLE (NESTED LOOP)
- USING LOOP TO PRINT ALPHABET
- USING LOOP TO MAKE A MENU
- arrays
- type casting
- using header files
- Keywords:
- else
- break;
- continue;
- case :
- data types are also keywords
- class
- const
- do
- while
- void
- for
- ╚ 200
- ╔ 201
- ╗ 187
- ╝ 188
- ═ 205
- ║ 186
- 0 BLACK
- 1 BLUE
- 2 GREEN
- 3 CYAN
- 4 RED
- 5 MAGENTA
- 6 BROWN
- 7 LIGHTGRAY
- 8 DARKGRAY
- 9 LIGHTBLUE
- 10 LIGHTGREEN
- 11 LIGHTCYAN
- 12 LIGHTRED
- 13 LIGHTMAGENTA
- 14 YELLOW
- 15 WHITE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement