lesson 5 showvars cpp
[[lesson_5_showvars_cpp]] last edit on
Aug 8, 2005
4:35 AM
by rescued_by_c
[user02@FC4 Lesson05]$ cat -n showvars.cpp
[user02@FC4 Lesson05]$ ./showvars
The employee is 32 years old
The employee makes $25000.8
The moon is 238857 miles from the earth
1 #include <iostream>
2 using namespace std;
3
4 int main()
5 {
6 int age = 32;
7 float salary = 25000.75;
8 long distance_to_the_moon = 238857;
9
10 cout << "The employee is " << age << " years old" << endl;
11 cout << "The employee makes $" << salary << endl;
12 cout << "The moon is " << distance_to_the_moon << " miles from the earth" << endl;
13
14 return 0;
15 }
[user02@FC4 Lesson05]$ g++ -o showvars showvars.cpp[user02@FC4 Lesson05]$ ./showvars
The employee is 32 years old
The employee makes $25000.8
The moon is 238857 miles from the earth