2-1question1.cpp

来自「This is solution code c++ in class lesso」· C++ 代码 · 共 61 行

CPP
61
字号
/*
1 display menu
2 ask user to select the choice between 6 option
3 verify the choice 
  if choice 1 convert from THB to USD
     ask user to enter the amount of muney to convert
     convert the currency using the formula
     display the output
  if choice 2 convert from USD to THB
     ask user to enter the amount of muney to convert
     convert the currency using the formula
     display the output
  if choice 3 convert from USD to JPY
     ask user to enter the amount of muney to convert
     convert the currency using the formula
     display the output
  if choice 4 convert from JPY to USD
     ask user to enter the amount of muney to convert
     convert the currency using the formula
     display the output
  if choice 5 convert from THB to JPY
     ask user to enter the amount of muney to convert
     convert the currency using the formula
     display the output
  if choice 6 convert from JPY to THB
     ask user to enter the amount of muney to convert
     convert the currency using the formula
     display the output
*/
#include<iostream>
using namespace std;
int main()
{

    cout << "++++++++++++++++++++ MENU +++++++++++++++++" << endl;
    cout << "1.) convert from THB to USD" << endl;
    cout << "2.) convert from USD to THB" << endl;
    cout << "3.) convert from USD to JPY" << endl;
    cout << "4.) convert from JPY to USD" << endl;
    cout << "5.) convert from THB to JPY" << endl;
    cout << "6.) convert from JPY to THB" << endl;
    cout << "++++++++++++++++++++++++++++++++++++++++++++++" << endl;
    cout << "Enter a choice (1 - 6): ";
    int choice;
    cin >> choice;
    if (choice == 1){
       double amount;
       cout << "Enter the amount of money to be convert: ";
       cin >> amount;
       double USD = amount / 32.78;
       cout << "The amount of " << amount << " Baht is equal to " << USD << " USD" << endl;
    }else if (choice == 2){
    }else if (choice == 3){
    }else if (choice == 4){
    }else if (choice == 5){
    }else if (choice == 6){
    }else{}
    system("Pause");
    return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?