May 2002
Beginner
320 pages
6h 18m
English
A program that performs calculations on predefined numbers is a good start, but most programs need to perform operations on data from the outside world. So let's extend the example again as shown in Listing 4.1.
1: #include <iostream> 2: 3: using namespace std; 4: 5: int main(int argc, char* argv[]) 6: { *7: int Dividend = 1; *8: cout << "Dividend: "; *9: cin >> Dividend; *10: *11: int Divisor = 1; *12: cout << "Divisor: "; *13: cin >> Divisor; 14: 15: int Result = (Dividend/Divisor); 16: cout << Result << endl; 17: 18: // Note: You must type something before the Enter key 19: char StopCharacter; *20: cout << endl << "Press a key and \"Enter\": "; *21: cin >> StopCharacter; 22: ... |
Read now
Unlock full access