#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int ht;
int row;
int index;
int topHt;
int initSpace;
do {
cout << "Enter the height of heart: ";
cin >> ht;
if (ht < 3) {
cout << "have a bigger heart!" << endl;
}
}while (ht < 3);
cout << endl << endl;
topHt = ht + 1;
initSpace = 40 - 2 * ht;
cout<<"\t\t\tI Just Wanna Spend My Life
With You\n\n";
for (row = 1; row < topHt; row++)
{
for (index = 0; index < initSpace; index++)
cout << " ";
for (index = 0; index < (topHt - row);
index++)
cout << " ";
for (index = 0; index < (row * 2 - 1);
index++)
cout << "*";
for (index = 0; index < (2 * (topHt - row)
- 1); index++)
cout << " ";
for (index = 0; index < (row * 2 - 1);
index++)
cout << "*";
cout << endl;
}
ht = ht * 2 + 1;
for (row = ht; row > 0; row--)
{
for (index = 0; index < initSpace; index++)
cout << " ";
for (index = 0; index < (ht - row); index+
+)
cout << " ";
for (index = 0; index < (row * 2 - 1);
index++)
cout << "*";
cout << endl;
}
cout << endl << endl;
getch();
}
0 comments:
Post a Comment