Advertisement
Guest User

Untitled

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