Advertisement
DrAungWinHtut

menu.cpp

Dec 3rd, 2024
89
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.33 KB | None | 1 0
  1. #include<iostream>
  2. #include<cstdlib> //stdlib.h
  3. using namespace std; //cout,cin,endl -> std::
  4. float calculateArea(float l, float w); //fun declare
  5. int calculateGoldPrice(int kyat, int pae, int yway, int currentGoldPrice);
  6. int main()
  7. {
  8.     int ans = 0;
  9.     while (ans != 3)
  10.     {
  11.         system("cls");
  12.         cout << "Menu System" << endl;
  13.         cout << "    1-Calculate Area" << endl;
  14.         cout << "    2-Calculate Gold Price" << endl;
  15.         cout << "    3-Exit" << endl;
  16.         cout << "    Choose 1,2,3: ";
  17.         cin >> ans;
  18.  
  19.         if (ans == 1) {
  20.             cout << "Area calculation" << endl;
  21.             calculateArea(11, 22);
  22.         }
  23.         else if (ans == 2)
  24.         {
  25.             cout << "Gold price calculation" << endl;
  26.             calculateGoldPrice(1, 2, 3, 6000000);
  27.         }
  28.         else if (ans == 3) {
  29.             cout << "Bye" << endl;
  30.             exit(0);
  31.         }
  32.         else {
  33.             cout << "Invalid input, choose 1,2,3 only!" << endl;
  34.         }
  35.         system("pause");
  36.     }
  37.     return 0;
  38. }
  39.  
  40. float calculateArea(float l, float w) //fun definition
  41. {  
  42.     float a = 0.0F;
  43.     a = l * w;
  44.     return a;    
  45. }
  46.  
  47. int calculateGoldPrice(int kyat, int pae, int yway, int currentGoldPrice)
  48. {
  49.     int totalGoldPrice = 0.0;
  50.     //calculate it
  51.     return totalGoldPrice;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement