Advertisement
Touch_Grass

Script 3

Jan 7th, 2023
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | Source Code | 0 0
  1. #include <iostream>
  2. //This is a currency converter. I am going to only make it be able to convert MYR(my currency) to USD
  3. //May change due to inflation
  4. //Accurate as of 7/1/2022
  5. using namespace std;
  6. int main() {
  7.     int RmPerUSD = .23;
  8.     int UsdPerRm = 4.40;
  9.     string ConversionMethod;
  10.     bool Running = true;
  11.     while (Running == true) {
  12.         cout<<"Conversion method(MYR>USD,USD>MYR)>"; cin >> ConversionMethod;
  13.         cout << "Note: It doesnt NOT like outputting decimal points." << endl;
  14.         if (ConversionMethod == "MYR>USD") {
  15.             int MYR;
  16.             cout << "MYR value>"; cin >> MYR;
  17.             cout << "Answer:" << MYR / UsdPerRm << endl;
  18.         }
  19.         else if (ConversionMethod == "USD>MYR") {
  20.             int usd;
  21.             cout << ">"; cin >> usd;
  22.             cout << "Answer" << usd / RmPerUSD << endl;
  23.         }else {
  24.             cout << "Syntax error: Not a recognized command" << endl;
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement