Advertisement
Guest User

Untitled

a guest
Jan 11th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.42 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.  
  56. char user[40];
  57. char pass[30],username[30][30]={"doni","bagus","eko","pandu"};
  58. char lagi;
  59.  
  60. int input;
  61.  
  62. //Tampilan Awal
  63. clrscr();
  64. title();
  65.     cout<<"Welcome to Grillicious Yummy Grills and More"<<endl;
  66.     cout<<"Choose your menu to work: "<<endl;
  67. garis();
  68.     cout<<"\n 1.Input Menu"<<endl;
  69.     cout<<" 2.Logout"<<endl;
  70. garis();
  71.     cout<<"\n Input here: ";
  72.     cin>>input;endl;
  73.  
  74.     clrscr();
  75.  
  76. title();
  77. if(input==1){
  78. garis();
  79.  
  80.     cout<<"\n User name: ";
  81.     cin>>user;
  82.     cout<<endl;
  83.     cout<<" Password: ";
  84.     cin>>pass;
  85.  
  86.  
  87. if(strcmp(username[0],user) == 0
  88.     || strcmp(username[1],user) == 0
  89.    || strcmp(username[2],user) == 0
  90.    || strcmp(username[3],user) == 0
  91.    && strcmp ("grillicious",pass) == 0){
  92.  
  93.   void loading();
  94.          cout << "\n======================================= \n\n";Sleep(600);
  95.          cout << "|          Anda Berhasil Login        |"<<endl;Sleep(1000);
  96.          cout << "======================================= \n\n";Sleep(600);
  97.          cout<<endl;
  98.    goto menu;
  99.    }
  100. if(pass!="grillicious")
  101.          { cout << "=======================================\n\n";Sleep(600);
  102.          cout << "|        PASSWORD ANDA Salah!         |\n"<<endl;Sleep(1000);
  103.          cout << "=======================================\n\n";Sleep(600);
  104.          cout<<endl;
  105.    return 0;
  106.    }}
  107.  
  108. //Tampilan input
  109. do{menu:
  110. clrscr();
  111. title();
  112. cout<<"\n** Logged Username: "<<user<<" **"<<endl;
  113. menu();
  114.  
  115. long proses (int p)
  116. {
  117.     int i,jp;
  118.     struct{
  119.     int banyak;
  120.     char item[30];
  121.     long harga,jumlah ;
  122.     }array[100];
  123.  
  124.     struct{
  125.     char nama[20];
  126.     int m;
  127.     }data;
  128.  
  129.         cout<<"Nama Pelangggan: ";
  130.         gets(data.nama);
  131.         cout<<"Input Jumlah Pesanan: ";
  132.         cin>>jp;
  133.         for(i=1;i<=jp;i++){
  134.         cout<<endl;
  135.         cout<<"Data ke-"<<i<<endl;
  136.         cout<<"Input Menu: ";
  137.         cin>>data.m;
  138.         if(data.m==1){
  139.         strcpy(array[i].item,"Sosis ayam bakar");
  140.         array[i].harga=10000;
  141.         }
  142.         if(data.m==2){
  143.         strcpy(array[i].item,"Sosis sapi bakar");
  144.         array[i].harga=12000;
  145.         }
  146.         if(data.m==3){
  147.         strcpy(array[i].item,"Sosis Black pepper bakar");
  148.         array[i].harga=11000;
  149.         }
  150.         if(data.m==4){
  151.         strcpy(array[i].item,"Sosis Cheese Bakar");
  152.         array[i].harga=13000;
  153.         }
  154.         if(data.m==5){
  155.         strcpy(array[i].item,"Bakso Bakar");
  156.         array[i].harga=8000;
  157.         }
  158.         if(data.m==6){
  159.         strcpy(array[i].item,"Coke");
  160.         array[i].harga=5000;
  161.         }
  162.         if(data.m==7){
  163.         strcpy(array[i].item,"Ice Tea");
  164.         array[i].harga=5000;
  165.         }
  166.         if(data.m==8){
  167.         strcpy(array[i].item,"Water");
  168.         array[i].harga=3000;
  169.         }
  170.  
  171.  
  172.     cout<<endl;
  173.     cout<<"Anda memesan: "<<array[i].item<<endl;
  174.     cout<<"Dengan harga: Rp."<<array[i].harga<<endl;
  175.     cout<<"Input Banyaknya: ";
  176.     cin>>array[i].banyak;
  177.     array[i].jumlah=array[i].harga*array[i].banyak;
  178.     cout<<"Jumlah: "<<array[i].jumlah;
  179.     cout<<endl;}
  180.  
  181.  
  182. //Tampilan Output
  183.  
  184.  
  185. struct{
  186. long total,dibayar,kembali,kurang;
  187. }data2;
  188.  
  189. data2.total=0;
  190. for (i=1;i<=jp;i++)
  191. {
  192. data2.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."<<data2.total<<endl;
  210. cout<<" Masukkan uang yang dibayar: Rp.";
  211. cin>>data2.dibayar;endl;
  212. data2.kembali=data2.dibayar-data2.total;
  213.  
  214. if (data2.kembali<0)
  215.  {
  216.  data2.kurang=data2.kembali*(-1);
  217.  cout<<" Maaf uang Anda kurang Rp."<<data2.kurang<<endl;
  218.  }
  219.  else
  220.  cout<<" Uang kembali: Rp."<<data2.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