help with assignemnt plz

how would i print a upside down right triangle formed with "*"? The number of rows in the triangle would be determined by user input.
Something like this:
*****
****
***
**
*

So far this is all i got
1
2
3
4
5
6
7
8
9
10
11

  #include <iostream>
using namespace std;
int main ()

{int a, c;
cout << "Enter the number of *s you want:" << endl;
cin >> a;
cout << "Which line do you want to be blank?" << endl;
cin >> c;
Last edited on
use nested loop.
ok, i kinda figured it out, but the second part is to add a blank line at user input. I have this so far, and i know i have to add an if statement somehwere in the loop, but where??


{
int a,b,c,d;

cout << "Enter the number of *s you want:" << endl;
cin >> a;
cout << "Which line do you want to be blank?" << endl;
cin >> d;

for (b = a; b >= 1; b = b-1)
{

for (c = 1; c <= b; c = c++)
{
cout << "*";
}
cout << "\n";

}
}
add if((a-b)==d){ cout<< '\n'; continue;}
Topic archived. No new replies allowed.