Jumat, 08 Januari 2010

Program C++ Untuk Menampilkan Bintang
Listing Program C++ untuk menampilkan deret bintang



#include
#include
void main()
{
int a,b,d,i,j;
cout<<"\t====================================\n";
cout<<"\t=====MENAMPILKAN DERET BINTANG======\n";
cout<<"\t====================================\n\n";
cout<<"(a) (b) (c) (d)\n";
for (d=1; d<=10; d++)
{ cout<
for(i=1; i<=d; i++)
{ cout<<"*"; }
}
for (d=10; d>=1; d--)
{
if ( d==10)
{
gotoxy(15,7);
for(j=1;j<=d;j++)
{ cout<<"*"; }
}
if ( d==9)
{
gotoxy(15,8);
for(j=1;j<=d;j++)
{ cout<<"*"; }
}
if ( d==8)
{
gotoxy(15,9);
for(j=1;j<=d;j++)
{ cout<<"*"; }
}
if ( d==7)
{
gotoxy(15,10);
for(j=1;j<=d;j++)
{ cout<<"*"; }
}
if ( d==6)
{
gotoxy(15,11);
for(j=1;j<=d;j++)
{ cout<<"*"; }
}
if ( d==5)
{
gotoxy(15,12);
for(j=1;j<=d;j++)
{ cout<<"*"; }
}
if ( d==4)
{
gotoxy(15,13);
for(j=1;j<=d;j++)
{ cout<<"*"; }
}
if ( d==3)
{
gotoxy(15,14);
for(j=1;j<=d;j++)
{ cout<<"*"; }
}
if ( d==2)
{
gotoxy(15,15);
for(j=1;j<=d;j++)
{ cout<<"*"; }
}
if ( d==1)
{
gotoxy(15,16);
for(j=1;j<=d;j++)
{ cout<<"*"; }
}

}
for (a=10;a>=1;a--)
{
if (a==10)
{
gotoxy(30,7);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==9)
{
gotoxy(31,8);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==8)
{
gotoxy(32,9);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==7)
{
gotoxy(33,10);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==6)
{
gotoxy(34,11);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==5)
{
gotoxy(35,12);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==4)
{
gotoxy(36,13);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==3)
{
gotoxy(37,14);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==2)
{
gotoxy(38,15);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==1)
{
gotoxy(39,16);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
}
for (a=1;a<=10;a++)
{
if (a==1)
{
gotoxy(55,7);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==2)
{
gotoxy(54,8);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==3)
{
gotoxy(53,9);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==4)
{
gotoxy(52,10);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==5)
{
gotoxy(51,11);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==6)
{
gotoxy(50,12);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==7)
{
gotoxy(49,13);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==8)
{
gotoxy(48,14);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==9)
{
gotoxy(47,15);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
if (a==10)
{
gotoxy(46,16);
for (b=1;b<=a;b++)
{ cout<<"*"; }
}
}
cout<<"\n\n\n\n\n";
cout<<"\t==========TUGAS STRUKTUR DATA==========\n";
cout<<"\t ====== I PUTU SUADNYANA ======\n";
cout<<"\t========== 008 01 255 ==========\n";
}

Tidak ada komentar:

Posting Komentar