Advertisement
kagemaro

Untitled

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