Advertisement
kagemaro

Untitled

Jan 8th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.05 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <iostream.h>
  4. #include <iomanip.h>
  5.  
  6.  
  7. title()
  8. {
  9.     cout<<"              Grillicious"<<endl;
  10.     cout<<"         Yummy Grills and More"<<endl;
  11.     cout<<"      ==========================="<<endl;
  12.     }
  13. garis()
  14. {
  15. cout<<"============================================";
  16. }
  17. menu(){
  18.     cout<<"***********************************************"<<endl;
  19.     cout<<"**               List Menu                   **"<<endl;
  20.     cout<<"***********************************************"<<endl;
  21.     cout<<"**  Meal                                     **"<<endl;
  22.     cout<<"** 1.Sosis Ayam Bakar         : Rp.10000 -,  **"<<endl;
  23.     cout<<"** 2.Sosis Sapi Bakar         : Rp.12000 -,  **"<<endl;
  24.     cout<<"** 3.Sosis Black Papper Bakar : Rp.11000 -,  **"<<endl;
  25.     cout<<"** 4.Sosis Cheese Bakar       : Rp.13000 -,  **"<<endl;
  26.     cout<<"** 5.Bakso Bakar              : Rp.8000 -,   **"<<endl;
  27.     cout<<"**                                           **"<<endl;
  28.     cout<<"** Beverages                                 **"<<endl;
  29.     cout<<"** 6.Coke                     : Rp.5000-,    **"<<endl;
  30.     cout<<"** 7.Ice Tea                  : Rp.5000-,    **"<<endl;
  31.     cout<<"** 8.Water                    : Rp.3000-,    **"<<endl;
  32.     cout<<"**                                           **"<<endl;
  33.     cout<<"***********************************************"<<endl;
  34.     }
  35.  
  36. main() //Ini main jangan ngilang lagi
  37. {
  38. char pass[12],user[12];
  39. int input;
  40.  
  41.  
  42. //Tampilan Awal
  43. title();
  44.     cout<<"Welcome to Grillicious Yummy Grills and More"<<endl;
  45.     cout<<"Choose your menu to work: "<<endl;
  46. garis();
  47.     cout<<"\n 1.Input Menu"<<endl;
  48.     cout<<" 2.Logout"<<endl;
  49. garis();
  50.     cout<<"\n Input here: ";
  51.     cin>>input;endl;
  52. clrscr();
  53. title();
  54. if(input==1){
  55. garis();
  56.     cout<<"\n User name: ";
  57.     cin>>user;endl;
  58.     cout<<" Password: ";
  59.     cin>>pass;endl;
  60. }
  61. else if(pass=="grillicious"){
  62.    goto menu;}
  63. else{
  64.     return 0;}
  65. garis();
  66. //Tampilan input
  67.  
  68. menu:
  69. clrscr();
  70. int i,jp;
  71.  
  72. struct{
  73. int banyak;
  74. char item[30];
  75. long harga,jumlah;
  76. }array[100];
  77.  
  78. struct{
  79. long total,dibayar,kembali,kurang;
  80. char nama[20];
  81. int m;
  82. }data;
  83.  
  84. title();
  85. menu();
  86.     cout<<"Nama Pelangggan: ";
  87.     gets(data.nama);
  88.     cout<<"Input Jumlah Pesanan: ";
  89.     cin>>jp;
  90.     for(i=1;i<=jp;i++){
  91.     cout<<endl;
  92.     cout<<"Data ke-"<<i<<endl;
  93.     cout<<"Input Menu: ";
  94.     cin>>data.m;
  95.         if(data.m==1){
  96.         strcpy(array[i].item,"Sosis ayam bakar");
  97.         array[i].harga=10000;
  98.         }
  99.         if(data.m==2){
  100.         strcpy(array[i].item,"Sosis sapi bakar");
  101.         array[i].harga=12000;
  102.         }
  103.         if(data.m==3){
  104.         strcpy(array[i].item,"Sosis Black pepper bakar");
  105.         array[i].harga=11000;
  106.         }
  107.         if(data.m==4){
  108.       strcpy(array[i].item,"Sosis Cheese Bakar");
  109.         array[i].harga=13000;
  110.         }
  111.         if(data.m==5){
  112.         strcpy(array[i].item,"Bakso Bakar");
  113.         array[i].harga=8000;
  114.         }
  115.       if(data.m==6){
  116.       strcpy(array[i].item,"Coke");
  117.       array[i].harga=5000;
  118.       }
  119.       if(data.m==7){
  120.       strcpy(array[i].item,"Ice Tea");
  121.       array[i].harga=5000;
  122.       }
  123.       if(data.m==8){
  124.       strcpy(array[i].item,"Water");
  125.       array[i].harga=3000;
  126.       }
  127.  
  128.  
  129.     cout<<endl;
  130.     cout<<"Anda memesan: "<<array[i].item<<endl;
  131.     cout<<"Dengan harga: Rp."<<array[i].harga<<endl;
  132.     cout<<"Input Banyaknya: ";
  133.     cin>>array[i].banyak;
  134.     array[i].jumlah=array[i].harga*array[i].banyak;
  135.     cout<<"Jumlah: "<<array[i].jumlah;
  136.     cout<<endl;}
  137.  
  138.  
  139. //Tampilan Output
  140.  
  141.  
  142.  
  143. data.total=0;
  144. for (i=1;i<=jp;i++)
  145. {
  146. data.total+=array[i].jumlah;
  147. }
  148. clrscr();
  149. title();
  150.  
  151.      cout<<"Nama Pelanggan :"<<data.nama<<endl;
  152.     cout<<"Daftar menu yang dipesan"<<endl;
  153.     cout<<"======================================================"<<endl;
  154.     cout<<"No     Item             Price     Qty      Total      "<<endl;
  155.     cout<<"======================================================"<<endl;
  156.     for(i=1;i<=jp;i++){
  157.         cout<<setiosflags(ios::left)<<setw(5)<<i;
  158.       cout<<setiosflags(ios::left)<<setw(24)<<array[i].item;
  159.         cout<<setprecision(30)<<setw(10)<<array[i].harga;
  160.       cout<<setprecision(20)<<setw(10)<<array[i].banyak;
  161.         cout<<setprecision(20)<<setw(10)<<array[i].jumlah<<endl;
  162.         }
  163. cout<<" Total belanja: Rp."<<data.total<<endl;
  164. cout<<" Masukkan uang yang dibayar: Rp.";
  165. cin>>data.dibayar;endl;
  166. data.kembali=data.dibayar-data.total;
  167.  
  168. if (data.kembali<0)
  169.  {
  170.  data.kurang=data.kembali*(-1);
  171.  cout<<" Maaf uang Anda kurang Rp."<<data.kurang<<endl;
  172.  }
  173.  else
  174.  cout<<" Uang kembali: Rp."<<data.kembali;
  175.  cout<<endl;
  176.  cout<<"------------------------------------------------------"<<endl;
  177.  cout<<"             HARGA SUDAH TERMASUK PPN"<<endl;
  178.  cout<<"------------------------------------------------------"<<endl;
  179.  cout<<"          TERIMA KASIH ATAS KUNJUNGAN ANDA"<<endl;
  180.  cout<<"------------------------------------------------------"<<endl;
  181.  
  182. int lagi;
  183.  cout<<"\n Apakah anda ingin melakukan transaksi lagi ? [Y/T]";
  184.  cin>>lagi;
  185.  
  186. if(lagi=='y','Y'){
  187.    goto menu;}
  188. else{
  189.    return 0;}
  190.  
  191.  getch();
  192.  
  193. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement