Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <iostream.h>
- #include <iomanip.h>
- title()
- {
- cout<<" Grillicious"<<endl;
- cout<<" Yummy Grills and More"<<endl;
- cout<<" ==========================="<<endl;
- }
- garis()
- {
- cout<<"============================================";
- }
- menu(){
- cout<<"***********************************************"<<endl;
- cout<<"** List Menu **"<<endl;
- cout<<"***********************************************"<<endl;
- cout<<"** Meal **"<<endl;
- cout<<"** 1.Sosis Ayam Bakar : Rp.10000 -, **"<<endl;
- cout<<"** 2.Sosis Sapi Bakar : Rp.12000 -, **"<<endl;
- cout<<"** 3.Sosis Black Papper Bakar : Rp.11000 -, **"<<endl;
- cout<<"** 4.Sosis Cheese Bakar : Rp.13000 -, **"<<endl;
- cout<<"** 5.Bakso Bakar : Rp.8000 -, **"<<endl;
- cout<<"** **"<<endl;
- cout<<"** Beverages **"<<endl;
- cout<<"** 6.Coke : Rp.5000-, **"<<endl;
- cout<<"** 7.Ice Tea : Rp.5000-, **"<<endl;
- cout<<"** 8.Water : Rp.3000-, **"<<endl;
- cout<<"** **"<<endl;
- cout<<"***********************************************"<<endl;
- }
- main() //Ini main jangan ngilang lagi
- {
- char pass[12],user[12];
- int input;
- //Tampilan Awal
- title();
- cout<<"Welcome to Grillicious Yummy Grills and More"<<endl;
- cout<<"Choose your menu to work: "<<endl;
- garis();
- cout<<"\n 1.Input Menu"<<endl;
- cout<<" 2.Logout"<<endl;
- garis();
- cout<<"\n Input here: ";
- cin>>input;endl;
- clrscr();
- title();
- if(input==1){
- garis();
- cout<<"\n User name: ";
- cin>>user;endl;
- cout<<" Password: ";
- cin>>pass;endl;
- }
- else if(pass=="grillicious"){
- goto menu;}
- else{
- return 0;}
- garis();
- //Tampilan input
- menu:
- clrscr();
- int i,jp;
- struct{
- int banyak;
- char item[30];
- long harga,jumlah;
- }array[100];
- struct{
- long total,dibayar,kembali,kurang;
- char nama[20];
- int m;
- }data;
- title();
- menu();
- cout<<"Nama Pelangggan: ";
- gets(data.nama);
- cout<<"Input Jumlah Pesanan: ";
- cin>>jp;
- for(i=1;i<=jp;i++){
- cout<<endl;
- cout<<"Data ke-"<<i<<endl;
- cout<<"Input Menu: ";
- cin>>data.m;
- if(data.m==1){
- strcpy(array[i].item,"Sosis ayam bakar");
- array[i].harga=10000;
- }
- if(data.m==2){
- strcpy(array[i].item,"Sosis sapi bakar");
- array[i].harga=12000;
- }
- if(data.m==3){
- strcpy(array[i].item,"Sosis Black pepper bakar");
- array[i].harga=11000;
- }
- if(data.m==4){
- strcpy(array[i].item,"Sosis Cheese Bakar");
- array[i].harga=13000;
- }
- if(data.m==5){
- strcpy(array[i].item,"Bakso Bakar");
- array[i].harga=8000;
- }
- if(data.m==6){
- strcpy(array[i].item,"Coke");
- array[i].harga=5000;
- }
- if(data.m==7){
- strcpy(array[i].item,"Ice Tea");
- array[i].harga=5000;
- }
- if(data.m==8){
- strcpy(array[i].item,"Water");
- array[i].harga=3000;
- }
- cout<<endl;
- cout<<"Anda memesan: "<<array[i].item<<endl;
- cout<<"Dengan harga: Rp."<<array[i].harga<<endl;
- cout<<"Input Banyaknya: ";
- cin>>array[i].banyak;
- array[i].jumlah=array[i].harga*array[i].banyak;
- cout<<"Jumlah: "<<array[i].jumlah;
- cout<<endl;}
- //Tampilan Output
- data.total=0;
- for (i=1;i<=jp;i++)
- {
- data.total+=array[i].jumlah;
- }
- clrscr();
- title();
- cout<<"Nama Pelanggan :"<<data.nama<<endl;
- cout<<"Daftar menu yang dipesan"<<endl;
- cout<<"======================================================"<<endl;
- cout<<"No Item Price Qty Total "<<endl;
- cout<<"======================================================"<<endl;
- for(i=1;i<=jp;i++){
- cout<<setiosflags(ios::left)<<setw(5)<<i;
- cout<<setiosflags(ios::left)<<setw(24)<<array[i].item;
- cout<<setprecision(30)<<setw(10)<<array[i].harga;
- cout<<setprecision(20)<<setw(10)<<array[i].banyak;
- cout<<setprecision(20)<<setw(10)<<array[i].jumlah<<endl;
- }
- cout<<" Total belanja: Rp."<<data.total<<endl;
- cout<<" Masukkan uang yang dibayar: Rp.";
- cin>>data.dibayar;endl;
- data.kembali=data.dibayar-data.total;
- if (data.kembali<0)
- {
- data.kurang=data.kembali*(-1);
- cout<<" Maaf uang Anda kurang Rp."<<data.kurang<<endl;
- }
- else
- cout<<" Uang kembali: Rp."<<data.kembali;
- cout<<endl;
- cout<<"------------------------------------------------------"<<endl;
- cout<<" HARGA SUDAH TERMASUK PPN"<<endl;
- cout<<"------------------------------------------------------"<<endl;
- cout<<" TERIMA KASIH ATAS KUNJUNGAN ANDA"<<endl;
- cout<<"------------------------------------------------------"<<endl;
- int lagi;
- cout<<"\n Apakah anda ingin melakukan transaksi lagi ? [Y/T]";
- cin>>lagi;
- if(lagi=='y','Y'){
- goto menu;}
- else{
- return 0;}
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement