Practice!
For each of the following expressions, specify the data type of the result given i
is an int
and d
is a double
:
5 + i * 2
d + i * 2
d / 9.33
7 / i
7.0 / i
42 + 7 / (i * 1.2)
In the end, the result is cast to the variable type, but there may be intermediate loss of precisions as in double y = 5 / 2
Demo: change the name from main to something else
Nested example: if (expression) { statement; }
Nested example: 5 * (2 + 1)
Demo: run Python script and compile C++ code
Demo overwriting hello.cpp
Draw internal memory stuff, emphasize that a variable is a name for a piece of memory
What value do you think x will have after declaration?
What if I tried to say double x?
Message: char is not the same as a string in Python
int, double, double, int, double double