Added exercise 4.28
[Cpp-Deitel-Exercises.git] / Chapter-4 / 4-21.cpp
blob4c8df339fb6e32b83c8f930a9f05f1b7bc698959
1 /*C++ How to Program, 9/E, by Paul Deitel & Harvey Deitel.
3 Solution of exercise 4.21:
4 // Exercise 4.21: ex04_21.cpp
5 // What does this program print?
6 #include <iostream>
7 using namespace std;
9 int main()
11 unsigned int count = 1; // initialize count
13 while ( count <= 10 ) // loop 10 times
15 // output line of text
16 cout << ( count % 2 ? "****" : "++++++++" ) << endl;
17 ++count; // increment count
18 } // end while
19 } // end main
21 Written by Juan Carlos Moreno (jcmhsoftware@gmail.com), 2023-02-21.*/
23 #include <iostream>
25 using namespace std;
27 int main()
29 unsigned int count = 1; //Initialize count
31 while ( count <= 10 ) //Loop 10 times
33 //Output line of text
34 cout << (count % 2 ? "****" : "++++++++") << endl;
35 ++count; //Increment count