Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that operates a currency conversion between US Dollar (USD) and

ID: 3565247 • Letter: W

Question

Write a program that operates a currency conversion between US Dollar (USD) and EURO (EUR).

1)Immediately after execution, the program asks the user to insert the exchange rate from EURO to USD(e.g. 1 EUR=1.27 USD).

2)Then, the program asks the user to select which currency conversion is desired.

3)Then, the program converts and displays (in a tabular form) the first ten amounts (1-10 USD or 1-10EUR) into the destination currency, using the appropriate exchange rate (EUR-> USD or USD->EUR).

4) The program loops over tasks 1, 2 and 3 to repeat the same procedure until the user entres an exchange rate of 0.

Explanation / Answer

#include<iostream>

using namespace std;

int main(){
int flag = 0;
double exchangeRate;
double euro = 1;
char choice;
do{
cout << "Enter the exchange rate from Euro to usd i.e How many usd is ";
cout << "equal to 1 euro : " ;
cin >> exchangeRate;
if(exchangeRate == 0){
flag = 1;
}
cout << "Which currency conversion do you desire : (E for euro / U for usd) : ";
cin >> choice;

if(choice == 'E' || choice == 'e'){
cout << "Euro " << " USD " << endl;
for(int i=1; i<=10; i++){
cout << " " << i << " " << i*exchangeRate << endl;
}
}
else{
cout << "USD " << " EURO " << endl;
for(int i= 1; i<= 10 ; i++){
cout << " " << i << " " << i/ exchangeRate << endl;
}
}
}while(!flag);
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote