Contoh Oprasi Percabangan IF Majemuk

#include
#include
#include
min ( )
{
float tot_beli,pot,jum_bay,ubay,kembalian;
char *hadiah,nama[10];
cout<<"TOKO KOMPUTER SELALU RAME\n";
cout<<"Nama Barang :";gets(nama);
cout<<endl;
cout<<"Nama Barang :"<<nama<<endl;
cout<>tot_beli;
if (tot_beli>=100000)
{
pot=0.3*tot_beli;
hadiah=”mouse”;
}
else
if (tot_bel>;=50000)
{
pot=0.15*tot_beli;
hadiah=”mouse pad”;
}
else
{
pot=0;
hadiah=”tidak dapat”;
}
cout<<"Besarnya Potongan :Rp."<<pot<<endl;
jum_bay=tot_beli-pot;
cout<<"jumlah yg harus di bayarkan :Rp."<<jum_bay<<endl;
cout<<"hadiah yg anda dapatkan adalah :"<<hadiah<<endl;
cout<>ubay;
kembalian=ubay-jum_bay;
cout<<"kembalian :"<<kembalian;
getch ( );
}

Ditulis dalam C++. Leave a Comment »

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: