Sponsor Iklan

Selasa, 11 November 2014

0 Fungsi IF pada pemrograman C++ (part2)

#include
#include
#include
main( )
{
char *mobil;
int kode;
long harga,l_sewa,u_bayar,u_kembali,tot_sewa;

clrscr();
cout<<"~~~~~~~~~~~~~~~~~~~~~~"<cout<<"KODE MOBIL:";cin>>kode;
cout<<"LAMA SEWA :";cin>>l_sewa;
if (kode==1)
  {
  mobil="MAZDA";
  harga=200000;
  }
else if (kode==2)
  {
  mobil="TOYOTA";
  harga=190000;
  }
else if (kode==3)
  {
  mobil="ISUZU";
  harga=180000;
  }
else
  {
  mobil="KODE SALAH";
  harga=0;
  }

clrscr();
cout<<"        THE ANGKOT     "<cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<cout<<"KODE MOBIL       : "<cout<<"NAMA MOBIL       : "<cout<<"HARGA PERHARI    : "<cout<<"LAMA SEWA        : "<tot_sewa=harga*l_sewa;
cout<<"TOTAL SEWA       : "<cout<<"UANG BAYAR       : ";cin>>u_bayar;
u_kembali=u_bayar-tot_sewa;
cout<<"UANG KEMBALI     : "<cout<<"+++++++++++++++++++++++++++++"<cout<<"NAMA     : Ilham Saputra \n";
cout<<"KELAS    : 12.1G.14.A \n";
cout<<"NIM      : 12124166 \n";

getch();
}

0 komentar:

Posting Komentar

Musik

Kursor

Batman Begins - Help Select

efek salju

Pages

mouse bintang