How to make diamond in C++. Size of diamond is depend upon user ??

3/13/2014 09:33:00 pm Unknown 0 Comments

How to make diamond in C++. Size of diamond is depend upon user ??

#include<iostream>
#include<conio.h>
using namespace std;
main()

{
int size;
cout<<"how large u want.. ";
cin>>size;
for(int i=1;i<=size;i++)
{for(int j=size;j>=i;j--)
cout<<" ";
for(int j=1;j<=i;j++)
cout<<"* ";
cout<<"\n";}

for( int i=size;i>=1;i--)
{for( int j=size;j>=i;j--)
cout<<" ";
for(int j=1;j<=i;j++)
cout<<"* ";
cout<<"\n";}

getch();

}