I've been working on this code for the past couple of days, and probably just need a fresh pair of eyes to look at my code. I almost have the triangle with spaces solved, but it looks like this:
-----*
-----**
-----***
-----****
-----*****
instead of what i want it to look like, which is this:
-----*
----**
---***
--****
-*****
******
Also, I have no clue where to even start with making a diamond shape.. any help, or start up of the code would be helpful.
Here's the code i have so far:
#include <iostream>
#include <math.h>
#include <string.h>
using namespace std;
int main()
{
{
// Make triangle shaped like so(- stands for blank space)
// ----*
// ---**
// --***
// -****
// *****
int rowSize3;
cout << "Please enter another row size for a different triangular shape: ";
cin >> rowSize3;
for (int r=0;r<=rowSize3;r++) // Number of lines to display
{
for (int c=0;c<rowSize3;c++)
{
cout << " ";
}
for (int c=0;c<r;++c)
{
cout << "*";
}
cout << endl;
}
}
{
// Make a Diamond shape like so
// *
// ***
// *****
// *******
// *****
// ***
// *
int rowSize4;
cout << "Please enter another row size for a diamond: ";
cin >> rowSize4;
for (int r=0;r<rowSize4;r++)
{
for (int c=0;c<r+1;c++)
{
cout << "*";
}
cout << endl;
}
}
system("pause");
return 0;
}