Hi, guys!
I have to write a program that prompts the user to enter an integer number for to draw a diamond.
The number would be longest part of the diamond.
I did upper part of the diamond but I cant continue the bottom part of the diamond.
could you please show me a way to complete the diamond ?
thanks in advance.
Code:
#include <iostream.h>
#include <stdlib.h>
int main()
{
b: int i,j,max,choose,min=1;
char c;
a: cout<<"Please enter a positive number so that we can draw a triangle; ";
cin>>choose;
if(choose<0)
{
cout<<"You have entered a negative number please try again."<<endl;
goto a;
}
if(choose%2==0)
choose --;
max=choose;
while(min<=choose)
{
for(j=1;j<max;j++)
cout<<" ";
for(i=0;i<min;i++)
cout<<"*";
min += 2;
max--;
cout<<"\n";
}
cout<<"Do you wish to continue Y/N? \n";
cin>>c;
if(c=='Y' || c=='y' )
goto b;
system("PAUSE");
return 0;
}