Laman

Selamat Datang Sahabat! Selamat ber-sharing Ilmu Komputer

Minggu, 26 Februari 2012

Borland Restaurant

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

main()
{
 int bayar, kembali, harga, total, totbay=0, pot, jumbel, nota;
 char nama[20], kdpaket[5], nampak[25], hadiah[10];
 clrscr();
 cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
 cout<<"        RESTAURANT CEPAT KENYANG"<<endl;
 cout<<"|| ==PAKET== ==NAMA MAKANAN== ==HARGA== ||"<<endl;
 cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
 cout<<"    PAKET 1  KAMBING GULING   Rp.75.000"<<endl;
 cout<<"    PAKET 2  AYAM BAKAR       Rp.50.000"<<endl;
 cout<<"    PAKET 3  PECEL LELE       Rp.25.000"<<endl;
 cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
 cout<<endl;
 cout<<"No. NOTA   : ";cin>>nota;
 cout<<"Masukkan Nama Pelanggan : ";cin>>nama;
 cout<<"Masukkan Kode Paket [P1/P2/P3] : ";cin>>kdpaket;
 if (!strcmp(kdpaket,"P1") || !strcmp(kdpaket,"p1"))
    {
     strcpy(nampak,"KAMBING GULING");
     harga=75000;
     }
 else if (!strcmp(kdpaket,"P2") || !strcmp(kdpaket,"p2"))
    {
     strcpy(nampak,"AYAM BAKAR");
     harga=50000;
     }
 else if (!strcmp(kdpaket,"P3") || !strcmp(kdpaket,"p3"))
    {
     strcpy(nampak,"PECEL LELE");
     harga=25000;
     }
 else
    {
    strcpy(kdpaket,"Salah Kode");
    }
 cout<<"Masukkan Jumlah Paket : ";cin>>jumbel;
 total=harga*jumbel;
 clrscr();
 cout<<"No. NOTA     : "<<nota<<endl;
 cout<<"Nama Pemesan : "<<nama<<endl;
 cout<<endl;
 cout<<"=========================================="<<endl;
 cout<<"        RESTAURANT CEPAT KENYANG"<<endl;
 cout<<"=========================================="<<endl;
 cout<<"Paket Yang Dipesan : "<<nampak<<endl;
 cout<<"Harga Satuan       : Rp. "<<harga<<endl;
 cout<<"Jumlah Paket       : "<<jumbel<<" Paket"<<endl;
 cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
 cout<<"Total Harga        : Rp. "<<total<<endl;
 if (jumbel>7)
   {
    pot=total*0.05;
    strcpy(hadiah,"KAOS");
   }
 else
   {
    pot=0;
    strcpy(hadiah,"PULPEN");
    }
 cout<<"Potongan Harga     : Rp. "<<pot<<endl;
 cout<<"Bonus Yang Didapat :  "<<hadiah<<endl;
 cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
 totbay=total-pot;
 cout<<"Total Pembayaran     : Rp. "<<totbay<<endl;
 cout<<"Uang Pembayaran Anda : Rp. ";cin>>bayar;
 kembali=bayar-totbay;
 cout<<"Uang Kembalian Anda  : Rp. "<<kembali<<endl;
 cout<<endl;
 cout<<"~~~~~~~~~~~~~~ TERIMA KASIH ~~~~~~~~~~~~~~"<<endl;
 getch();
}

Check result Outputnya :