May 2002
Beginner
320 pages
6h 18m
English
Now you are ready to move ahead and enhance the example you worked with in the last lesson. This time, you are replacing a line, not adding one. Have a look at Listing 3.1.
1: #include <iostream>
2:
3: using namespace std;
4:
5: int main(int argc, char* argv[])
6: {
*7: // Should print the number 6
*8: cout << ((6/2)+3) << endl;
9: return 0;
10: }
|
This program displays the value 6, which is the result of calculating ((6/2)+3). |
((6/2)+3) is an example of an expression. In this case, the expression uses literal numbers, operators (/ and +), and ...
Read now
Unlock full access