Advertisement
kagemaro

Untitled

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