-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCurrency Converter.cpp
40 lines (32 loc) · 1.06 KB
/
Currency Converter.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
// Conversion rates
double amountUSD;
cout << "Enter amount in USD: ";
cin >> amountUSD;
const double USD_TO_EUR = 0.915807;
const double USD_TO_GBP = 0.786544;
const double USD_TO_JPY = 143.705;
const double USD_TO_INR = 81.9959;
const double USD_TO_PKR = 286.44;
// Conversion calculations
double amountEUR = amountUSD * USD_TO_EUR;
double amountGBP = amountUSD * USD_TO_GBP;
double amountJPY = amountUSD * USD_TO_JPY;
double amountINR = amountUSD * USD_TO_INR;
double amountPKR = amountUSD * USD_TO_PKR;
// Display results
cout << fixed << setprecision(2);
cout << "Amount\t\tCurrency" << endl;
cout << "-------------------------" << endl;
cout << amountUSD << "\t\tUSD" << endl;
cout << amountEUR << "\t\tEUR" << endl;
cout << amountGBP << "\t\tGBP" << endl;
cout << amountJPY << "\t\tJPY" << endl;
cout << amountINR << "\t\tINR" << endl;
cout << amountPKR << "\t\tPKR" << endl;
return 0;
}