Followers

Wednesday, 20 March 2013

Contoh Program Sederhana Bahasa Pemograman C++ menggunakan IF,ealse,strcpy moga bermanfaat.

Contoh Program Sederhana Bahasa Pemograman C++ menggunakan IF,ealse,strcpy moga bermanfaat.

#include
#include
#include
main()
{
char nama[30],nabar[20],kode,gudang[20],satuan[20],bonus[20];
long harga,jumbel,ubay,ukem,total,bayar;
clrscr();
cout<<"Toko bangunan Adi Jaya Semesta\t"<cout<<"\tHP : 08569968234"<cout<<"_________________________________"<cout<<"Nama petugas :";cin>>nama;
cout<<"kode barang[a/b/c] :";cin>>kode;
cout<<"_________________________________"<if(kode=='a'||kode=='A')
{
strcpy(nabar,"Semen");
strcpy(satuan,"Sak");
harga=50000;
}
else if(kode=='b'||kode=='B')
{
strcpy(nabar,"Pasir");
strcpy(satuan,"colt");
harga==100000;
}
else if(kode=='c'||kode=='C')
{
strcpy(nabar,"Batu");
strcpy(satuan,"Buah");
harga=1000;
}
else
{
strcpy(nabar,"tidak ada");
strcpy(satuan,"tidak ada");
harga=0;
}
cout<<"Nama Petugas :"<cout<<"kode Pilihan :"<cout<<"Nama Barang :"<cout<<"Satuan :"<cout<<"Harga :"<cout<<"Jumlah Beli :";cin>>jumbel;
bayar=harga*jumbel;
cout<<"Total Bayar :"<if(bayar>=100000)
{
strcpy(bonus,"baju");
}
else if(bayar>=500000)
{
strcpy(bonus,"Kaos kaki");
}
else if(bayar<500000)
{
strcpy(bonus,"gak Dapet");
}
cout<<"bonus :"<cout<<"Uang Bayar :";cin>>ubay;
ukem=ubay-bayar;
cout<<"Uang Kembali :Rp."<getch();
}

TRANSLATE

Radio Music Player Free Online