In this exercise you will create a program that uses two for
In this exercise, you will create a program that uses two for statements to display the pattern of asterisks shown in Figure 8-25. If necessary, create a new project named TryThis9 Project, and save it in the Cpp8\\Chap08 folder. Enter the C++ instructions into a source file named TryThis9.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Save and then run the program. (The answers to TRY THIS Exercises are located at the end of the chapter.)
Solution
#include <iostream>
using namespace std;
int main()
{
for(int row=10;row>0;row=row-2)
{
for(int col=1;col<=row;col+=1)
cout<<\'*\';
cout<<endl;
}
return 0;
}
