Tugas C++

Posted by: Dyan / Category:

#include < stdio.h >
#include < conio.h >
#include < iostream.h >
main ()
{
   char nama[30],kode,*merk,tanya,type,*type_hp;
   long harga,total,uang,kembali;
   float jumbel;
   lagi:
   ulang:
   cout<<"TOKO HANDPHONE CANGGIH \n";
   cout<<"Lab C Sore \n";
   cout<<"================================= \n";
    cout<<"Nama Pembeli\t\t : ";gets(nama);
   cout<<"Kode HP [A/B/C/D/E]\t : ";cin>>kode;
   cout<<"Type HP [1/2/3]\t\t : ";cin>>type;
   cout<<"Jumlah Beli \t\t : ";cin>>jumbel;
   if (kode=='A'||kode=='a')
   {
       merk="Nokia";
      if(type=='1')
      {type_hp="N70";harga=1000000;}
      else
      if (type=='2')
      {type_hp="E72";harga=4000000;}
      else
      {type_hp="5310";harga=850000;}
   }
   else
   if (kode=='B'||kode=='b')
   {
       merk="Sony Ericsson";
      if(type=='1')
      {type_hp="W950i";harga=1200000;}
      else
      if (type=='2')
      {type_hp="K790i";harga=1000000;}
      else
      {type_hp="U1i Satio";harga=6800000;}
   }
   else
   if (kode=='C'||kode=='c')
   {
       merk="Samsung";
      if(type=='1')
      {type_hp="S8003 Jet";harga=4500000;}
      else
      if (type=='2')
      {type_hp="S3653 Corby";harga=1500000;}
      else
      {type_hp="C6625";harga=1800000;}
   }
   else
   if (kode=='D'||kode=='d')
   {
       merk="Motorola";
      if(type=='1')
      {type_hp="V3i";harga=850000;}
      else
      if (type=='2')
      {type_hp="RAZR V8 Luxury";harga=5700000;}
      else
      {type_hp="EM30";harga=1100000;}
   }
   else
   if (kode=='E'||kode=='e')
   {
       merk="Blackberry";
      if(type=='1')
      {type_hp="Bold 9000";harga=4500000;}
      else
      if (type=='2')
      {type_hp="Tour 9630";harga=3900000;}
      else
      {type_hp="Javelin 8900";harga=3700000;}
   }
   else
   {
   cout<<"Anda salah memasukkan kode !!!" << endl;
   goto ulang;
   }
   cout<<"\n";
   cout<<"---------------------------------\n";
   cout<<"Merk HP\t : "<< merk << endl;
   cout<<"Type HP\t : "<< type_hp << endl;
    cout<<"Harga \t : "<< harga << endl;
   cout<<"--------------------------------- \n";
      total=harga*jumbel;
   cout<<"Total Bayar \t : "<< total << endl;
   cout<<"Uang Bayar \t : ";cin>>uang;
   kembali=uang-total;
   cout<<"Kembali \t : "<< kembali << endl;
   cout<<"================================= \n";
   cout<<"\t TERIMA KASIH \n";
   cout<<"\n";
   cout<<"Input Lagi [Y/T] : ";cin>>tanya;
   clrscr();
   if (tanya=='Y'||tanya=='y')
   goto lagi;
   else
   goto selesai;
getch();
selesai:
}

Output nya sebagai berikut :



1 komentar:

  1. ogan lee Says:

    wah...ganti tampilan nich blog.....
    oke...
    tugas dah diterima
    keep blogging....

Posting Komentar