Advertisement
Guest User

100% Jadi

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