LOOP Help!

I'm having trouble on how to close my figure. The diamond should be inside the square . but mine is slightly separated from the top and on the sides. can some one help me. The starting parameter is 7 for the square and X-2 for the diamond inside. Hope you can help me.

Here's the code.. :

------------------------------------------------------------------------

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879`` ``````#include "stdafx.h" #include using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int a,b,x,y,i,j; cout<<"Input a Number:"<>x; a=x; if (x<=6) { cout<<"You should enter an ODD number, 7 onwards"< 0; i--) { for(j = (x/2 + 1); j > i; j--) cout << " "; for(j = (i*2 - 1); j > 0; j--) { if ((j == (i*2 - 1)) || (j == 1)) { cout << "*"; } else { cout << " "; } } cout << endl; } } else cout<<"x should be Odd Number\n"; for (y=0;y

------------------------------------------------------------------
Last edited on
please give us an example of output that you expect.
Topic archived. No new replies allowed.