Halaman

Rabu, 28 April 2010

Tugas C++

#include
#include
#include
main()
{
char kode,*merk,kd_type,*type,tanya;
long harga,total,bayar,kembali;
int jml;
mulai:
clrscr();
cout <<" TOKO ELEKTRONIK"<cout <<" RIDWAN "<cout <<"--------------------------------------"<cout <<"Kode TV = ";cin>>kode;
cout <<"Kode Type = ";cin>>kd_type;
cout <<"Jumlah Beli = ";cin>>jml;
switch (kode)
{
case 'A':case 'a':
merk = "TV SAMSUNG";
switch (kd_type)
{
case '1':
type ="29 inchi";
harga =4500000;
break;
case '2':
type ="21 inchi";
harga =2500000;
break;
default:
type ="14 inchi";
harga =1750000;
break;
}
case 'B':case 'b':
merk = "TV LG";
switch (kd_type)
{
case '1':
type ="29 inchi";
harga =3750000;
break;
case '2':
type ="21 inchi";
harga =2200000;
break;
default:
type ="14 inchi";
harga =16500000;
break;
}
default:
merk ="PANASONIC";
switch (kd_type)
{
case '1':
type ="29 inchi";
harga =3850000;
break;
case '2':
type ="21 inchi";
harga =2400000;
break;
default:
type ="14 inchi";
harga =1800000;
break;
}
}
clrscr();
cout <<" TOKO ELEKTRONIK"<cout <<" RIDWAN "<cout <<"--------------------------------------"<cout <<"Kode TV = "<cout <<"Kode Type = "<cout <<"Jumlah Beli = "<cout <<"--------------------------------------"<cout <<"Merk TV = "<cout <<"Type TV = "<cout <<"Harga TV = "<cout <<"--------------------------------------"<total=harga*jml;
cout <<"Total Bayar = "<cout <<"Uang Bayar = ";cin>>bayar;
kembali=bayar-total;
cout <<"--------------------------------------"<cout <<"Kembali = "<cout <<"--------------------------------------"<cout <<"Mau Input Lagi [Y/T]";cin>>tanya;
if (tanya=='Y'||tanya=='y')
goto mulai;
else
goto selesai;
getch();
selesai:
}





Tugas C++