Prinsip Pemrograman "PROGRAM PEMBUATAN BINTANG" pada C++
PROGRAM PEMBUATAN BINTANG
#include <iostream.h>
#include <conio.h>
void main()
{
int jum;
cout<<" PROGRAM PEMBUATAN BINTANG \n\n";
cout<<"=======================================\n";
cout<<"\tNama
: I Made Danan Widagdo\n";
cout<<"\tNIM
: 140010341\n";
cout<<"\tKelas : AA141\n";
cout<<"=======================================\n\n";
cout<<"Masukkan Besar Skala Bintang [1-20] :
"; cin>>jum;
clrscr();
for(int
a=1;a<=(jum-1);a++)
{
for(int b=(jum+jum-1);a<=b;b--)
{
cout<<" ";
}
for(int
c=1;c<=a;c++)
{
cout<<"*";
}
for(int
c=2;c<=a;c++)
{
cout<<"*";
}
cout<<endl;
}
for(int
a=((jum*3)+1);a>=(((jum*3)+2)-jum);a--)
{
for(int b=((jum*3)+1);a<=b;b--)
{
cout<<" ";
}
for(int
c=1;c<=a-(jum+2);c++)
{
cout<<"*";
}
for(int
c=1;c<=a-(jum+3);c++)
{
cout<<"*";
}
cout<<endl;
}
for(int
a=(jum-1);a>=1;a--)
{
for(int b=a;b>=1;b--)
{
cout<<" ";
}
for(int
c=jum;c>=1;c--)
{
cout<<"*";
}
for(int
d=1;d<=(jum-a);d++)
{
cout<<" ";
}
for(int
d=2;d<=(jum-a);d++)
{
cout<<" ";
}
for(int
c=jum;c>=1;c--)
{
cout<<"*";
}
cout<<endl;
}
getch();
}
0 comments: