Hi,
I am supposed to make a program in which you give 2 numbers and those 2 numbers should be the width and height of a triangle made with "*". If I cin 3 and 5 I get:
**
*
*
**
*
*
**
*
*
**
*
*
**
*
*
While I should get:
***
***
***
***
***
Can anyone explain this to me?
Here is my code:
#include <iostream>
using namespace std;
int main(int argc, char **argv) {
int Height, Width, i, j;
cin >> Height;
cin >> Width;
Switch for loops for width and hight and delite >cout << "*" ;< between for loops and >cout << endl;< should be outside the inner for loop.
That should fix your problem.