May 2002
Beginner
320 pages
6h 18m
English
A variable allows the program to perform its calculation outside of the cout statement.
1: #include <iostream>
2:
3: using namespace std;
4:
5: int main(int argc, char* argv[])
6: {
*7: const int Dividend = 6;
*8: const int Divisor = 2;
*9:
*10: int Result = (Dividend/Divisor);
*11: Result = Result + 3;// Result is now its old value+3=6
*12:
*13: cout << Result << endl;
14:
15: // Note: You must type something before the Enter key
16: char StopCharacter;
17: cout << endl << "Press a key and \"Enter\": ";
18: cin >> StopCharacter;
19:
20: return 0;
21: }
Lines 7–13 have been changed. |
Lines 7 and 8 declare variables ...
Read now
Unlock full access