Advertisement
IMustRemainUnknown

FRANK LEE 1

Oct 14th, 2022 (edited)
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.05 KB | None | 0 0
  1. Mathematical Operators:
  2. +, -, *, /, %
  3.  
  4.  
  5. int a, b, c;
  6. b=0;
  7. c=1
  8.  
  9. a = b+c;
  10.  
  11.  
  12. Assignment operator:
  13. =
  14. a+=2; //a=a+2
  15. -=
  16.  
  17. Logical Operators:
  18. == <= >= !=
  19. ! && ||
  20.  
  21. 1,0, true, false
  22.  
  23.  
  24. Data types:
  25. bool        true, false, 1, 0
  26. int         -3, 1, 2. etc.
  27. float   -3.1416, 1.01, 2.1. etc.
  28. char        'a', 'b', 'Z', '\n', '0'
  29. long int    same as int but can hold bigger number
  30. double  same as float but can hold bigger number
  31.  
  32. void        no type/ valueless
  33.  
  34. non-primitive:
  35. string  "I can type a word here"
  36.  
  37.  
  38. TEST TIME
  39.  
  40. CONDITIONAL STATEMENTS
  41. IF
  42. ELSE IF
  43. SWITCH
  44. NESTED IF (Login SYSTEM)
  45.  
  46. COMMENT
  47. // SINGLE LINE
  48. /* MULTIPLE LINES */
  49.  
  50. VARIABLE SCOPES:
  51. LOCAL
  52. GLOBAL
  53.  
  54. Looping statements:
  55. while
  56. do while
  57. for
  58. goto
  59. (What is iteration) (it's a repeatitions)
  60.  
  61.     switch(variable){
  62.         case condition:
  63.             break;
  64.         case condition:
  65.             break;
  66.         default:
  67.             break;
  68.     }
  69.  
  70. int main() {
  71.     char cod;
  72.    
  73.     while(cod != 'x'){
  74.         cout << "Enter CODE: ";
  75.         cin >> cod;
  76.     }
  77.    
  78.     return 0;
  79. }
  80.  
  81. #include <iostream>
  82.  
  83. using namespace std;
  84.  
  85.  
  86. int main(){
  87.     char choice = 'y';
  88.     int num;
  89.    
  90.     while(choice == 'y'){
  91.         cout << "Enter a number: ";
  92.         cin >> num;
  93.        
  94.         cout << "The number is: " << num << endl;
  95.        
  96.         cout << "_____________________\n";
  97.         cout << "Type y to continue: ";
  98.         cin >> choice;
  99.        
  100.         cout << endl;
  101.         system("cls");
  102.     }
  103.    
  104.     return 0;
  105. }
  106.  
  107. --------------------------------------------------------------
  108.  
  109. Jump Statements:
  110. break (stop loop)
  111. continue (skip)
  112. return (stop the function)
  113. goto (jump)
  114.  
  115. USING LOOP TO PRINT NUMBERS
  116. USING LOOP TO PRINT TRIANGLE (NESTED LOOP)
  117. USING LOOP TO PRINT ALPHABET
  118. USING LOOP TO MAKE A MENU
  119.  
  120.  
  121.  
  122. arrays
  123. type casting
  124. using header files
  125.  
  126.  
  127. Keywords:
  128. else
  129. break;
  130. continue;
  131. case :
  132. data types are also keywords
  133. class
  134. const
  135. do
  136. while
  137. void
  138. for
  139.  
  140.  
  141. ╚ 200
  142. ╔ 201
  143. ╗ 187
  144. ╝ 188
  145.  
  146. ═ 205
  147. ║ 186
  148.  
  149.  
  150. 0   BLACK
  151. 1   BLUE
  152. 2   GREEN
  153. 3   CYAN
  154. 4   RED
  155. 5   MAGENTA
  156. 6   BROWN
  157. 7   LIGHTGRAY
  158. 8   DARKGRAY
  159. 9   LIGHTBLUE
  160. 10  LIGHTGREEN
  161. 11  LIGHTCYAN
  162. 12  LIGHTRED
  163. 13  LIGHTMAGENTA
  164. 14  YELLOW
  165. 15  WHITE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement