lesson 11 nochange cpp
[[lesson_11_nochange_cpp]] last edit on
Aug 18, 2005
6:51 AM
by rescued_by_c
[user02@FC4 Lesson11]$ cat -n nochange.cpp
[user02@FC4 Lesson11]$ ./nochange
Values before function 2002 and 0
The values within display_values are 1001 and 1001
Values after function 2002 and 0
[user02@FC4 Lesson11]$
1 #include <iostream> 2 using namespace std; 3 4 void display_values(int a, int b)
5 {
6 a = 1001;
7 b = 1001;
8
9 cout << "The values within display_values are " << a << " and " << b << endl;
10 }
11
12 int main()
13 {
14 int big = 2002, small = 0;
15
16 cout << "Values before function " << big << " and " << small << endl;
17
18 display_values(big, small);
19
20 cout << "Values after function " << big << " and " << small << endl;
21
22 return 0;
23 }
[user02@FC4 Lesson11]$ g++ -o nochange nochange.cpp[user02@FC4 Lesson11]$ ./nochange
Values before function 2002 and 0
The values within display_values are 1001 and 1001
Values after function 2002 and 0
[user02@FC4 Lesson11]$