change this code to do the same purpose and same output :
C++ , change this code to do the same purpose and same output :
Source Code:
#include <iostream>
using namespace std;
void convert_from_AED(float amt, int to) {
float prices[10] = {3.653000,
4.250930,
4.958710,
0.230970,
0.049350,
0.074380,
2.662350,
2.757670,
0.032880,
0.022950};
amt = amt / prices[to];
cout << "\n\nConverted Amount is: " << amt;
}
void convert_to_AED(float amt, int from) {
float prices[10] = {3.685000,
4.533530,
5.293750,
0.236360,
0.050920,
0.076750,
2.810320,
2.957860,
0.034570,
0.023780};
amt = amt * prices[from];
cout << "\n\nConverted Amount is: " << amt;
}
int main()
{
int choice, curr;
float amt;
cout << "\n\nFOREIGN EXCHANGE\n================";
cout << "\n\n1. Convert currency from AED \n"
<< "2. Convert currency to AED \n"
<< "Enter Choice number: ";
cin >> choice;
cout << "\n\n0. USD - US Dollar \n"
<< "1. EUR - Euro \n"
<< "2. GBP - British Pound \n"
<< "3. EGP - Egyptian Pound \n"
<< "4. INR - Indian Rupee \n"
<< "5. PHP - Philippine Peso \n"
<< "6. SGD - Singapore Dollar \n"
<< "7. AUD - Australian Dollar \n"
<< "8. JPY - Japan Yen \n"
<< "9. PKR - Pakistan Rupee \n"
<< "Enter Choice number: ";
cin >> curr;
cout << "\n\nEnter Amount: \n";
cin >> amt;
switch(choice) {
case 1: convert_from_AED(amt, curr);
break;
case 2: convert_from_AED(amt, curr);
break;
default: break;
}
}
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)