Hi, I am in dire need of help. I have tried every way I could think up and I cant get it
I need a diamond that looks like perfect rhombus with an a border:
(im trying to get this site to make my shape to come out right but the site only makes it look like a triangle sorry)
^
^ ^
^ * ^
^ * * ^
^ * * * ^
^ * * * * ^
^ * * * * * ^
^ * * * * ^
^ * * * ^
^ * * ^
^ * ^
^ ^
^
where there is an inner diamond and a outer diamond. I am working on the inner diamond because i feel if I can mast the inside I can probably figure how to put the border on it.
I have no idea what I am doing wrong. I have one side lines up perfectly but I cant get the other side to.
Note: I am not to use any manipulators such as setw() etc... and it must be in a sequential order for example the first row has 1 character, the second has two, the third has three..... and so on,.....
This is my code:
#include<iostream>
using namespace std;
int main()
{
int size, i, j, k, l;
cout << "size = ";
cin >> size;
for (i = 0; i < size; i++)
{
for (k = 0; k < size - i; k++)
cout << " ";
for (j = 0; j < i + 1; j++)
{
cout << "*";
for (l = 0; l < size - i; l++)
cout << " ";
}
cout << endl;
}
for (i = size - 2; i >= 0; i--)
{
for (k = 0; k < size - i; k++)
cout << " ";
for ( j = 0; j < i + 1; j++)
{
cout << "*";
for (l = 0; l < size - i; l++)
cout << " ";
}
cout << endl;
}
return 0;
}