|
|
 |
|
|
|
|
6: int Doubler(int AmountToDouble);
7:
8: int main()
9: {
10:
11: int result = 0;
12: int input;
13:
14: cout << Enter a number between 0 and 10,000 to double: ;
15: cin >> input;
16:
17: cout << \nBefore doubler is called ;
18: cout << \ninput: << input << doubled: << result << \n;
19:
20: result = Doubler(input);
21:
22: cout << \nBack from Doubler\n;
23: cout << \ninput: << input << doubled: << result << \n;
24:
25:
26: return 0;
27: }
28:
29: int Doubler(int original)
30: {
31: if (original <= 10000)
32: return original * 2;
33: else
34: return -1;
35: cout << You can't get here!\n;
36: } |
|
|
|
|
|
|
|
|
Enter a number between 0 and 10,000 to double: 9000
Before doubler is called
input: 9000 doubled: 0
Back from doubler
input: 9000 doubled: 18000 |
|
|
|
|
|
|
|
|
Enter a number between 0 and 10,000 to double: 11000
Before doubler is called
input: 11000 doubled: 0
Back from doubler
input: 11000 doubled: -1 |
|
|
|
|
|