I am trying to make a Isosceles triangle by outputting a single character on a single line on the command line. I don't know why it only prints out the half of the Isosceles triangle. It ignores the part of the for loop of rows of decreasing length.
#include <iostream>
#include <cctype>
usingnamespace std;
int main() {
int m;
cout << "Enter a width in between 1 - 70: ";
cin >> m;
cin.ignore(1000, 10);
while (m < 1 || m > 70) {
cout << "Please enter a correct width again!" << endl;
return main();
}
int n = 1;
while(true)
{
for (int i= 0 ; i < m; ++i)
{
for (int j = 0; j < n; ++j)
{
for ( int k=0 ; k <i ;++k)
{
cout << '*' ;
}
}
cout << endl;
}
for (int i = m; i < m; i--){
for( int j = 0; j <n ; ++j){
for (int k=m ; k <i ; k--){
cout << '@';}
}
cout <<endl;
}
}
}