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;
}
``````

Edited by mike_2000_17: Fixed formatting

1
Contributor
2
Replies
4
Views
7 Years
Discussion Span
Last Post by ana_1234

Never mind I found the answer i did incorporate any spaces between my char

Now i need help on the diamond

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.