#include"stdafx.h"
#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
int space_margin;
int size=10;
int S_height;
char ch;
space_margin = 10;
do{
cout << "Enter the size of the diamond please = ? ";
cin >> size;
for (int i = 0; i <= size; i++)
{
S_height = space_margin + size - i;
for (int j = 0; j <= S_height; j++)
{
cout << ' ';
}
for (int j = 0; j <= i * 2; j++)
{
cout << "X";
}
cout << endl;
}
int sp;
for (int i = size; i >= 0; i--)
{
sp = S_height + size - i;
for (int j = sp; j >= 0; j--)
{
cout << ' ';
}
for (int j = i * 2; j >= 0; j--)
{
cout << "X";
}
cout << endl;
}
cout <<endl<<"Do you wish wants to contiue......Y/N"<<endl;
cin >> ch;
} while (ch == 'y' || ch == 'Y');
_getch();