Laman

Selamat Datang Sahabat! Selamat ber-sharing Ilmu Komputer

Sabtu, 25 Februari 2012

Borland sellular

#include <conio.h>
#include <stdio.h>
#include <iomanip.h>
#include <iostream.h>

main()
{
 int harga, jumbel, total, totbay=0, bayar, kembali,pot;
 char nama[20], kdhp[5], nmhp[20];
 clrscr();
 cout<<"========================================="<<endl;
 cout<<"             BRITISH CELLULAR"<<endl;
 cout<<"=Kode HP=  =Merk HP=       =Harga HP= "<<endl;
 cout<<"========================================="<<endl;
 cout<<"   SE     Sony Ericsson   Rp.1.500.000"<<endl;
 cout<<"   BB     Blackberry      Rp.1.800.000"<<endl;
 cout<<"   N73    Nokia 73        Rp.2.000.000"<<endl;
 cout<<"   SG     Samsung Galaxy  Rp.2.200.000"<<endl;
 cout<<"========================================="<<endl;
 cout<<endl;
 cout<<"Masukkan Nama Pembeli : ";cin>>nama;
 cout<<"Masukkan Kode HP : ";cin>>kdhp;
 if (!strcmp(kdhp,"SE") || !strcmp(kdhp,"se"))
    {
     strcpy(nmhp,"Sony Ericsson");
     harga=1500000;
    }
 else if (!strcmp(kdhp,"BB") || !strcmp(kdhp,"bb"))
    {
     strcpy(nmhp,"Blackberry");
     harga=1800000;
    }
 else if (!strcmp(kdhp,"N73") || !strcmp(kdhp,"n73"))
    {
     strcpy(nmhp,"Nokia 73");
     harga=2000000;
    }
 else if (!strcmp(kdhp,"SG") || !strcmp(kdhp,"sg"))
    {
     strcpy(nmhp,"Samsung Galaxy");
     harga=2200000;
    }
 else
    {
     strcpy(nmhp,"Salah Kode");
     harga=0;
    }
 cout<<"Masukkan Jumlah Beli : ";cin>>jumbel;
 total=jumbel*harga;
 cout<<endl;
 clrscr();
 cout<<"========================================="<<endl;
 cout<<"             BRITISH CELLULAR"<<endl;
 cout<<"========================================="<<endl;
 cout<<"Nama Pembeli  : "<<nama<<endl;
 cout<<"Merk HP       : "<<nmhp<<endl;
 cout<<"Harga Satuan  :Rp. "<<harga<<endl;
 cout<<"Jumlah Beli   : "<<jumbel<<endl;
 cout<<"========================================="<<endl;
 cout<<"Total Harga    :Rp. "<<total<<endl;
 if (jumbel>5)
   {
    pot=total*0.05;
   }
 else
   {
    pot=0;
   }
 cout<<"Potongan Harga :Rp. "<<pot<<endl;
 cout<<"========================================="<<endl;
 totbay=total-pot;
 cout<<"Total Pembayaran  :Rp. "<<totbay<<endl;
 cout<<endl;
 cout<<"Masukkan Uang Bayar Anda   Rp. ";cin>>bayar;
 kembali=bayar-totbay;
 cout<<"Uang Kembalian Anda adalah Rp. "<<kembali<<endl;
 cout<<endl;
 cout<<"~~~~~~~~~~~~~ TERIMA KASIH ~~~~~~~~~~~~~"<<endl;
 getch();
}

Check result Outputnya :

Tidak ada komentar:

Posting Komentar