lesson 10 getave cpp
[[lesson_10_getave_cpp]] last edit on
Aug 18, 2005
6:05 AM
by rescued_by_c
[user02@FC4 Lesson10]$ cat -n getave.cpp
[user02@FC4 Lesson10]$ ./getave
The average value is: 7.5
[user02@FC4 Lesson10]$
1 #include <iostream>
2 using namespace std;
3
4 float average_value(int a, int b)
5 {
6 return((a + b) / 2.0);
7 }
8
9 int main()
10 {
11 cout << "The average value is: " << average_value(5, 10) << endl;
12
13 return 0;
14 }
[user02@FC4 Lesson10]$ g++ -o getave getave.cpp[user02@FC4 Lesson10]$ ./getave
The average value is: 7.5
[user02@FC4 Lesson10]$