help with drawing a triangle plz

I have made a program to draw only the outline of a triangle which ask the user to choose a character and the ask for the height of the triangle.
but I'm not sure what is wrong with my code
if someone please could help me
this is what I have so far:

#include <iostream>
using namespace std;


int main() {
int height, rows, cols;
char brush;


cout << "Please input a character for your brush: ";
cin >> brush;
cout << "Please enter the height of your triangle: ";
cin >> height;

for (rows = 1; rows <= height; rows++){
cout << endl;
for (cols = 1; cols <= height; cols++)

if(rows + cols == height + 1 || (rows - cols == height - 1)){
cout << brush;
cout << endl;
}
else
cout << " " << " ";
}
cout << endl;
return 0;
}
Last edited on
Topic archived. No new replies allowed.