lesson 10 addvalue cpp
[[lesson_10_addvalue_cpp]] last edit on Aug 18, 2005 6:05 AM by rescued_by_c

[user02@FC4 Lesson10]$ cat -n addvalue.cpp
   1  #include <iostream>
   2  using namespace std;
   3
   4  int add_values(int a, int b)
   5  {
   6     return(a+b);
   7  }
   8
   9  int main()
  10  {
  11     cout << "100 + 200 = " << add_values(100, 200) << endl;
  12     cout << "500 + 501 = " << add_values(500, 501) << endl;
  13     cout << "-1 + 1 = " << add_values(-1, 1) << endl;
  14
  15     return 0;
  16  }
[user02@FC4 Lesson10]$ g++ -o addvalue addvalue.cpp
[user02@FC4 Lesson10]$ ./addvalue
100 + 200 = 300
500 + 501 = 1001
-1 + 1 = 0
[user02@FC4 Lesson10]$