Modifying the value of a variable:
More Assignment Statements
CORRECT int counter; counter = 20; |
INCORRECT int counter; counter = 12.2; |
More Programming Basics
int num=20, num2=3;
float x; x = num/num2; //division is integer cout << x; // 6 is printed |
float num=20, num2=3;
float x; x = num/num2; //division is floating cout << x; // 6.33 is printed |
char inChar; cin >> inChar; cout << inChar << " has the value "<< static_cast<int>(inChar);
Formatting Output
1.23 351.34
Characters and Strings AGAIN