Laman

Selamat Datang Sahabat! Selamat ber-sharing Ilmu Komputer

Kamis, 01 Maret 2012

Borland Dealer Motor

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

main()
{
 int i,n,harga[5],jumbel[5],tot[5],total=0,totbay,ppn,bayar,kembali;
 char lagi,nama[30],kd_mot[10][5],motor[5][10],tp[10][5],tipe[5][15];
 atas:
 clrscr();
 cout<<"        SUGARA DEALER MOTOR"<<endl;
 cout<<"======================================"<<endl;
 cout<<" Kode Motor   Tipe           Harga  "<<endl;
 cout<<"--------------------------------------"<<endl;
 cout<<"  H   Honda   Revo (R)   Rp.13.000.000"<<endl;
 cout<<"              Scoopy (S) Rp.14.000.000"<<endl;
 cout<<"  Y   Yamaha  Mio (M)    Rp.13.500.000"<<endl;
 cout<<"              Vega R (V) Rp.12.700.000"<<endl;
 cout<<"======================================"<<endl<<endl;
 cout<<"Masukkan Nama Pembeli : ";cin>>nama;
 cout<<endl;
 cout<<"Masukkan Jumlah Data : ";cin>>n;
 cout<<endl;
 for(i=1;i<=n;i++)
 {
  cout<<"Data Ke - "<<i<<endl;
  cout<<"Kode Motor [H/Y] : ";cin>>kd_mot[i];
  cout<<"Tipe Motor [R/S/M/V] : ";cin>>tp[i];
  cout<<"Jumlah Beli : ";cin>>jumbel[i];
  cout<<endl;
  if (!strcmp(kd_mot[i],"H") || !strcmp(kd_mot[i],"h"))
  {
   strcpy(motor[i],"Honda");
   if (!strcmp(tp[i],"R") || !strcmp(tp[i],"r"))
   { strcpy(tipe[i],"Revo");
     harga[i]=13000000;}
   else if (!strcmp(tp[i],"S") || !strcmp(tp[i],"s"))
   { strcpy(tipe[i],"Scoopy");
     harga[i]=14000000;}
   else
   { strcpy(tipe[i],"Salah Kode");
     harga[i]=13000000;}
  }
  else if (!strcmp(kd_mot[i],"Y") || !strcmp(kd_mot[i],"y"))
  {
   strcpy(motor[i],"Yamaha");
   if (!strcmp(tp[i],"M") || !strcmp(tp[i],"m"))
   { strcpy(tipe[i],"Mio");
     harga[i]=13500000;}
   else if (!strcmp(tp[i],"V") || !strcmp(tp[i],"v"))
   { strcpy(tipe[i],"Vega R");
     harga[i]=12700000;}
   else
   { strcpy(tipe[i],"Salah Kode");
     harga[i]=13000000;}
  }
 }
 clrscr();
 cout<<"                  SUGARA DEALER MOTOR"<<endl;
 cout<<"========================================================="<<endl<<endl;
 cout<<"Nama Pembeli  : "<<nama<<endl<<endl;
 cout<<"---------------------------------------------------------"<<endl;
 cout<<"No. Kode   Merk    Tipe       Harga    Jumlah    Total"<<endl;
 cout<<"    Motor  Motor   Motor               Beli         "<<endl;
 cout<<"---------------------------------------------------------"<<endl;
 for(i=1;i<=n;i++)
 {
  cout<<setiosflags(ios::left)<<setw(5)<<i;
  cout<<setiosflags(ios::left)<<setw(6)<<kd_mot[i];
  cout<<setiosflags(ios::left)<<setw(8)<<motor[i];
  cout<<setiosflags(ios::left)<<setw(8)<<tipe[i];
  cout<<setiosflags(ios::left)<<"Rp."<<setw(11)<<harga[i];
  cout<<setiosflags(ios::left)<<setw(5)<<jumbel[i];
  tot[i]=harga[i]*jumbel[i];
  cout<<setiosflags(ios::left)<<"Rp."<<setw(5)<<tot[i]<<endl;
  total=total+tot[i];
 }
 cout<<"---------------------------------------------------------"<<endl;
 cout<<"Total Harga  : Rp."<<total<<endl;
 ppn=total*0.1;
 cout<<"PPN 10%      : Rp."<<ppn<<endl;
 totbay=total+ppn;
 cout<<"Total Bayar  : Rp."<<totbay<<endl;
 cout<<"Uang Bayar   : Rp.";cin>>bayar;
 kembali=bayar-totbay;
 cout<<"Uang Kembali : Rp."<<kembali<<endl<<endl;
 cout<<"\t\t\tTERIMA KASIH"<<endl<<endl<<endl;
 cout<<"Mau Input Lagi [Y/T] ? : ";cin>>lagi;lagi=getche();
 if (lagi=='Y' || lagi=='y')
 { goto atas;}
 getch();
}

Check result hasil Outputnya :



Tidak ada komentar:

Posting Komentar