Advertisement
kagemaro

Grillicious V.1.2

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