Find Here !!!

Monday, 17 March 2014

Program C++ Menggunakan FOR

Jam Pasir

_______________________________________________________
#include"iostream.h"
#include"conio.h"

void main()
{
long int angka,a,b,c;
char karakter,pil;
do{

cout<<" Mardhy\n";
cout<<" S1 Informatika\n";

cout<<"+=====================+\n";
cout<<"Masukkan Angka  : ";
cin>>angka;
cout<<"Masukkan Karakter : ";
cin>>karakter;
cout<<"+=====================+\n";
for(a=1;a<=angka;a++){
for(c=1;c<=a;c++){
cout<<" ";
}
for(b=angka;b>=a;b--){
cout<<karakter;cout<<" ";
}
cout<<endl;
}
for(a=1;a<=angka;a++){
for(b=angka;b>=a;b--){
cout<<" ";
}
for(c=1;c<=a;c++){
cout<<karakter;cout<<" ";
}
cout<<endl;
}
cout<<"+=====================+\n";
cout<<"Apakah anda ingin mengulang?"<<endl;
cout<<"Pilihan (y/t) :"; cin>>pil;
clrscr();
} while (pil=='y');
cout<<"+=====================+\n";
cout<<"Terimakasih ^_^ \n";
cout<<"Silahkan Datang Kembali\n";
cout<<"+=====================+\n";
}

______________________________________________________

Semoga Bermanfaat :)

Karya Cipta : Mardhy (STT-PLN)

No comments:

Post a Comment