[user02@FC4 Lesson08]$ cat -n dog_cat.cpp
1 #include <iostream>
2 using namespace std;
3
4 int main()
5 {
6 int user_owns_a_dog = 1;
7 int user_owns_a_cat = 0;
8
9 if (user_owns_a_dog)
10 cout << "Dogs are great" << endl;
11
12 if (user_owns_a_cat)
13 cout << "Cats are great" << endl;
14
15 if ((user_owns_a_dog) && (user_owns_a_cat))
16 cout << "Dogs and cats can get along" << endl;
17
18 if ((user_owns_a_dog) || (user_owns_a_cat))
19 cout << "Pets are great!" << endl;
20
21 return 0;
22 }
[user02@FC4 Lesson08]$ g++ -o dog_cat dog_cat.cpp[user02@FC4 Lesson08]$ ./dog_cat
Dogs are great
Pets are great!
lesson_8_dog_cat.cpp, Rev. 1, Last changed on 2005-08-10 03:27, 286 page hits