Berikut ini adalah Contoh Program Aplikasi Pembelian Menu Makanan di restaurant SAGALA AYAM Menggunakan C++. Pengunjung masuk ke dalam restaurant lalu menentukan hidangan masakan yang akan dipesan menurut jumlah hidangan dan banyak kuantiti hidangan makanannya.
Untuk lebih jelasnya simak penjelasannya dibawah ini ;
1. Buka aplikasi borland c++
2.Pilih File > New > text edit
3. Pastekan koding dibawah ini ;
#include<conio.h>
#include<stdio.h>
#include<iostream.h>
#include<iomanip.h>
main( )
{
char x,jenis[10];
int i,hrg,banyk_j,banyk_beli[100],j_hrg[10],j_bay=0;
long tot_bay;
float pajak;
pilihan:
clrscr();
cout<<"=============================="<<endl;
cout<<" RESTAURANT SAGALA AYAM "<<endl;
cout<<"=============================="<<endl;
cout<<"A. Ayam Bakar Madu |"<<endl;
cout<<"B. Ayam Bakar Sambal Hijau |"<<endl;
cout<<"C. Ayam Goreng Crispy | "<<endl;
cout<<"D. Sup Ayam Ceker | "<<endl;
cout<<"E. Ayam Mercon Pedas |"<<endl;
cout<<"=============================="<<endl;
cout<<"\n";
cout<<"Input Banyak Menu : ";cin>>banyk_j;
cout<<endl;
for(i=1;i<=banyk_j;i++)
{
cout<<"Menu Ke - "<<i<<endl;
cout<<"Kode Menu [A/B/C/D/E] : ";cin>>jenis[i];
cout<<"Kuantiti/Porsi : ";cin>>banyk_beli[i];
cout<<endl;
}
cout<<endl;
cout<<" RESTAURANT SAGALA AYAM "<<endl;
cout<<"------------------------------------------------------------"<<endl;
cout<<"No. Menu Harga Kuantiti Jumlah"<<endl;
cout<<" Ayam Satu Porsi Porsi Harga"<<endl;
cout<<"------------------------------------------------------------"<<endl;
for(i=1;i<=banyk_j;i++)
{
cout<<setiosflags(ios::left)<<setw(5)<<i;
cout<<setiosflags(ios::left)<<setw(20);
if(jenis[i]=='A'||jenis[i]=='a')
{
cout<<"Ayam Bakar Madu";
cout<<setw(18)<< setiosflags(ios::left);
hrg=25000;
cout<<"25000";
}
else if (jenis[i]=='B'||jenis[i]=='b')
{
cout<<"Ayam Bakar S.Hijau";
cout<<setw(18)<< setiosflags(ios::left);
hrg=26000;
cout<<"26000";
}
else if (jenis[i]=='C'||jenis[i]=='c')
{
cout<<"Ayam Goreng Crispy";
cout<<setw(18)<< setiosflags(ios::left);
hrg=20000;
cout<<"20000";
}
else if (jenis[i]=='D'||jenis[i]=='d')
{
cout<<"Sup Ayam Ceker";
cout<<setw(18)<< setiosflags(ios::left);
hrg=15000;
cout<<"15000";
}
else if (jenis[i]=='E'||jenis[i]=='e')
{
cout<<"Ayam Mercon Pedas";
cout<<setw(18)<< setiosflags(ios::left);
hrg=27000;
cout<<"27000";
}
else
{
cout<<"Salah Kode";
cout<<setw(18)<< setiosflags(ios::left);
hrg=0;
cout<<"0";
}
cout<<setiosflags(ios::left)<<setw(8)<<banyk_beli[i];
j_hrg[i]= banyk_beli[i] * hrg;
cout<<"Rp "<<j_hrg[i]<<endl ;
j_bay= j_bay + j_hrg [i];
}
cout<<"------------------------------------------------------------"<<endl;
cout<< " \t\tJumlah Bayar Rp "<<j_bay<< endl ;
pajak = (j_bay*10)/100;
cout<< " \t\tPajak(10%) Rp "<<pajak<<endl;
tot_bay = j_bay+pajak;
cout<< " \t\tToyal Bayar Rp "<<tot_bay<<endl<<endl ;
cout<<"==================TERIMA KASIH================\t"<<endl<<endl;
cout<<"NAMA : Juhaeri Ruhmanudin \n";
cout<<"KELAS : 12.1C.14 \n";
cout<<"NIM : 12160468 \n""\n""\n";
cout<<"===========Selamat Berbelanja Kembali==========\t"<<endl<<endl;
cout<<"KEMBALI KE MENU AWAL [Y/X]??:";cin>>x;
if(x=='Y'||x=='y')
{
clrscr();
goto pilihan;
}
getch();
}
#include<stdio.h>
#include<iostream.h>
#include<iomanip.h>
main( )
{
char x,jenis[10];
int i,hrg,banyk_j,banyk_beli[100],j_hrg[10],j_bay=0;
long tot_bay;
float pajak;
pilihan:
clrscr();
cout<<"=============================="<<endl;
cout<<" RESTAURANT SAGALA AYAM "<<endl;
cout<<"=============================="<<endl;
cout<<"A. Ayam Bakar Madu |"<<endl;
cout<<"B. Ayam Bakar Sambal Hijau |"<<endl;
cout<<"C. Ayam Goreng Crispy | "<<endl;
cout<<"D. Sup Ayam Ceker | "<<endl;
cout<<"E. Ayam Mercon Pedas |"<<endl;
cout<<"=============================="<<endl;
cout<<"\n";
cout<<"Input Banyak Menu : ";cin>>banyk_j;
cout<<endl;
for(i=1;i<=banyk_j;i++)
{
cout<<"Menu Ke - "<<i<<endl;
cout<<"Kode Menu [A/B/C/D/E] : ";cin>>jenis[i];
cout<<"Kuantiti/Porsi : ";cin>>banyk_beli[i];
cout<<endl;
}
cout<<endl;
cout<<" RESTAURANT SAGALA AYAM "<<endl;
cout<<"------------------------------------------------------------"<<endl;
cout<<"No. Menu Harga Kuantiti Jumlah"<<endl;
cout<<" Ayam Satu Porsi Porsi Harga"<<endl;
cout<<"------------------------------------------------------------"<<endl;
for(i=1;i<=banyk_j;i++)
{
cout<<setiosflags(ios::left)<<setw(5)<<i;
cout<<setiosflags(ios::left)<<setw(20);
if(jenis[i]=='A'||jenis[i]=='a')
{
cout<<"Ayam Bakar Madu";
cout<<setw(18)<< setiosflags(ios::left);
hrg=25000;
cout<<"25000";
}
else if (jenis[i]=='B'||jenis[i]=='b')
{
cout<<"Ayam Bakar S.Hijau";
cout<<setw(18)<< setiosflags(ios::left);
hrg=26000;
cout<<"26000";
}
else if (jenis[i]=='C'||jenis[i]=='c')
{
cout<<"Ayam Goreng Crispy";
cout<<setw(18)<< setiosflags(ios::left);
hrg=20000;
cout<<"20000";
}
else if (jenis[i]=='D'||jenis[i]=='d')
{
cout<<"Sup Ayam Ceker";
cout<<setw(18)<< setiosflags(ios::left);
hrg=15000;
cout<<"15000";
}
else if (jenis[i]=='E'||jenis[i]=='e')
{
cout<<"Ayam Mercon Pedas";
cout<<setw(18)<< setiosflags(ios::left);
hrg=27000;
cout<<"27000";
}
else
{
cout<<"Salah Kode";
cout<<setw(18)<< setiosflags(ios::left);
hrg=0;
cout<<"0";
}
cout<<setiosflags(ios::left)<<setw(8)<<banyk_beli[i];
j_hrg[i]= banyk_beli[i] * hrg;
cout<<"Rp "<<j_hrg[i]<<endl ;
j_bay= j_bay + j_hrg [i];
}
cout<<"------------------------------------------------------------"<<endl;
cout<< " \t\tJumlah Bayar Rp "<<j_bay<< endl ;
pajak = (j_bay*10)/100;
cout<< " \t\tPajak(10%) Rp "<<pajak<<endl;
tot_bay = j_bay+pajak;
cout<< " \t\tToyal Bayar Rp "<<tot_bay<<endl<<endl ;
cout<<"==================TERIMA KASIH================\t"<<endl<<endl;
cout<<"NAMA : Juhaeri Ruhmanudin \n";
cout<<"KELAS : 12.1C.14 \n";
cout<<"NIM : 12160468 \n""\n""\n";
cout<<"===========Selamat Berbelanja Kembali==========\t"<<endl<<endl;
cout<<"KEMBALI KE MENU AWAL [Y/X]??:";cin>>x;
if(x=='Y'||x=='y')
{
clrscr();
goto pilihan;
}
getch();
}
4. Jalankan programnya, maka muncul menyerupai dibawah ini ;
Keterangan : Masukkan jumlah banyaknya hidangan yang akan dipesan
5. Tekan enter, dan silahkan input isyarat hidangan makanannya serta jumlah banyaknya
6. Maka akan keluar sub total, pajak 10% serta jumlah yang harus dibayarkan
Demikianlah Contoh Program Aplikasi Pembelian Menu Makanan Menggunakan C++ supaya menjadi sumber tumpuan anda Sumber http://www.hendrisetiawan.com