Guest User

Untitled

a guest
Dec 18th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4.  
  5. struct makanan {
  6. /*
  7. int nasi = 4000;
  8. int ayam = 6000;
  9. int rendang = 7000;
  10. int perkedel = 3000;
  11. int tahu = 2000;
  12. int tempe = 2000;
  13. int kikil = 4000;
  14. int telur_dadar = 3000;
  15. int telur_bulat = 2500;
  16. int kerupuk = 1000;
  17. int esteh = 3000;
  18. int esjeruk = 3000;
  19. int aires = 1000;
  20. int airputih = 0;
  21. */
  22.  
  23. int menupilihan[14] = {
  24. 4000, 6000, 7000, 3000, 2000, 2000, 4000, 3000, 2500, 1000, 3000, 3000, 1000, 0
  25. };
  26.  
  27. }mkn;
  28.  
  29. void menu() {
  30. awal:
  31. system("clear");
  32. cout << "===== KASIR RM. PADANG =====" << endl;
  33. cout << endl;
  34. cout << "1. Nasi" << endl;
  35. cout << "2. Ayam" << endl;
  36. cout << "3. Rendang" << endl;
  37. cout << "4. Perkedal" << endl;
  38. cout << "5. Tahu" << endl;
  39. cout << "6. cin >> jumlah=1;Tempe" << endl;
  40. cout << "7. Kikil" << endl;
  41. cout << "8. Telur Dadar" << endl;
  42. cout << "9. Telur Bulat" << endl;
  43. cout << "10. Kerupuk" << endl;
  44. cout << "11. Es Teh" << endl;
  45. cout << "12. Es Jeruk" << endl;
  46. cout << "13. Air Es" << endl;
  47. cout << "14. Air Putih" << endl;
  48. cout << endl;
  49. cout << "0. -- Sudah --" << endl;
  50.  
  51. bool sudah = false;
  52. int pilih;
  53. int total=0;
  54. int jumlah;
  55. int bayar;
  56. char ulang;
  57.  
  58. while(!sudah) {
  59. cout << "makan : "; cin >> pilih;
  60. if(pilih == 0) {
  61. break;
  62. }
  63. total += mkn.menupilihan[(pilih-1)];
  64. }
  65. cout << endl;
  66. cout << "Total : " << total << endl;
  67. cout << "Bayar : "; cin >> bayar;
  68. cout << "Kembalian: " << bayar - total << endl;
  69. cout << endl;
  70. cout << "Ulangi ? "; cin >> ulang;
  71. if (ulang == 'y' || ulang == 'Y') {
  72. goto awal;
  73. }
  74. }
  75.  
  76. void login() {
  77. string user, password;
  78. string userAuth = "admin";
  79. string passwordAuth = "admin";
  80.  
  81. system("clear");
  82.  
  83. login:
  84. cout << "===== KASIR RM. PADANG =====" << endl;
  85. cout << "User : "; cin >> user;
  86. password:
  87. cout << "Password : "; cin >> password;
  88.  
  89. if(user == userAuth) {
  90. if(password == passwordAuth) {
  91. menu();
  92. }
  93. else {
  94. cout << "Password salah!" << endl;
  95. goto password;
  96. }
  97. } else {
  98. cout << "User salah!" << endl;
  99. goto login;
  100. }
  101. }
  102.  
  103. main() {
  104. cout << "===== KASIR RM. PADANG =====" << endl;
  105. cout << endl << endl;
  106. cout << "1. Login" << endl;
  107. cout << "2. Exit" << endl;
  108. cout << "3. History" << endl;
  109. cout << "Pilih : ";
  110. int pilih;
  111. cin >> pilih;
  112.  
  113. switch(pilih) {
  114. case 1:
  115. login();
  116. break;
  117.  
  118. case 2:
  119. system("exit");
  120. break;
  121.  
  122. case 3:
  123. break;
  124.  
  125. }
  126. }
Add Comment
Please, Sign In to add comment