I'm working on this program for school and I need the output to look like this
*
**
***
****
*****
This is the code I have so far. I can't seem to make it work and honestly I can't understand the logic of the for statement for this. Could someone please walk me through the for statement?
Code://************************
//Doug Miller
//Lab 6_1
//Shape Program
//**********************
#include <iostream>
using namespace std;
int main ()
{
int row_Col = 0;
int i = 0;
int m = 0;
int n = 0;
bool start = 0;
char answer;
const char star = '*';
cout << "Drawing hallow boxes program " << endl;
cout << "\n\n";
cout << "Do you want to start (y/n): " << endl;
cin >> answer;
cout << "\n\n";
if (answer == 'y' || answer == 'Y')
{
start = true;
}
else if (answer == 'n' || answer == 'N')
{
start = false;
}
else
{
cout << "You entered an invalid character" <<endl;
}
while (start == true)
{
cout << "How many rows/columns would you like to work with? " << endl;
cin >> row_Col;
cout << "\n\n";
while (row_Col < 5 || row_Col > 21)
{
cout << "Out of range! Reenter: " << endl;
cout << "\n\n";
cin >> row_Col;
}
for (i = 1; i <= row_Col; i++)
{
for(m = 0; m < row_Col; m=m++)
{
cout << star;
}
}
cout << "Do you want to start (y/n): " << endl;
cin >> answer;
cout << "\n\n";
if (answer == 'n' || answer == 'N')
{
start = false;
}
}
return 0;
std::cin.get();
}// End of program!