Solve the following in C++ only . CURRENCY CONVERTER Write a program that will d
ID: 3868410 • Letter: S
Question
Solve the following in C++ only .
CURRENCY CONVERTER Write a program that will display the following output. First, the user will select the currency to be converted and enter input MYR value by blank. The value will be displayed in currency chosen. Explain your software/program in a flow chart and discuss the advantages and disadvantages of your program. Include suggestions for future improvements in the assignment. Example: The program is to convert Malaysia Ringgit (MYR) to other currencies. Currency converter 1) Singapore Dolar (SGD) 2) United States Dollar (USD) 3) Australia Dollar (AUD) 4) Euro (EUR) 5) India Rupee (INR) Please enter your choice (1-5) to be converted: ____ 2 ____ Please enter MYR value: ___ 1000 __ The value in Australia Dollar (AUD) is: AUD ___ 232.59 ______.Explanation / Answer
This program converts Malaysian Ringgit into other contries currency like (Singapore Dollar, United States,Australian Dollar, Euro, Indian Rupee).
The program works as follows:
1.Displays the Menu showing other countries currencies to whiich MYR can be converted to
2. Takes the input for the currency to which MYR is to be converted
3. Takes input in MYR (Checks for zero value)
4. Based on the choice in step 2 , converts the MYR into that currency.
5. Displays the value in the chosen currency.
6. Waits for input to run again
Steps have been commented as follows in the program:
#include<iostream>
using namespace std;
int main()
{
double MYR,conv_value; //declaring variables
int ch,value=1; //declaring variables
while(value!=0) // Running a bigger loop to continue the program again
{
//Displaying menu options showing currencies to which MYR can be conv_valuerted to)
cout << "1.To Singapore dollar (SGD) ";
cout << "2.To United States Dollar (USD) ";
cout << "3.To Australia Dollar (AUD) ";
cout << "4. To Euro (EUR) ";
cout << "5.To India Rupee ";
cout << "Enter choice : ";
cin>>ch;
if(ch>=1 && ch<=5)
{
cout<<"Enter Malaysia Ringgit (MYR) amount : ";
cin>>MYR; //Taking the input for MYR
if(MYR!=0)
{
if(ch==1)
conv_value=MYR*0.32; //conv_valueerting to SGD
else if(ch==2)
conv_value=MYR*0.23; // conv_valueerting to USD
else if(ch==3)
conv_value=MYR*0.30; // conv_valueerting to AUD
else if(ch==4)
conv_value=MYR*0.20; // conv_valueerting to EUR
else if(ch==5)
conv_value=MYR*14.96; // conv_valueerting to INR
cout<<"conv_valueerted value is : "<< conv_value <<endl; // Displaying the conv_valueerted value
}
else if(MYR==0)
cout<<"Enter non-zero value."; // Checking for non-zero value
}
if(ch<1 || ch>5) // Checking the right choice
cout<<"Wrong choice. ";
cout<<"Do you want to continue?(1:yes || 0:No) : "; // Asking for continuing the program
cin>>value;
cout<<" ";
}
}