currency converter for c 2b 2b

Solutions on MaxInterview for currency converter for c 2b 2b by the best coders in the world

showing results for - "currency converter for c 2b 2b"
Lya
14 Jul 2020
1#include <iostream>
2
3using namespace std;
4
5int main(){
6
7    string currency;
8
9    string currency2;
10
11    double amount;
12
13    double amount2;
14
15    cout << "What currency would you like to convert? \n";
16
17    cout << "The currencies are: Rupees, Dollars, Pesos, and Euros. \n";
18
19    cin >> currency;
20
21    cout << "What currency would you like to convert to? \n";
22
23    cin >> currency2;
24
25    cout << "How much money would you like to convert? \n";
26
27    cin >> amount;
28
29
30    if (currency == "dollars"){
31
32        if (currency2 == "rupees"){
33
34            amount2 = amount * 72.51;
35
36            cout << amount << "$ is equal to " << amount2 << "₹\n";
37
38        }else if (currency2 == "pesos"){
39
40            amount2 = amount * 19.95;
41
42            cout << amount << "$ is equal to " << amount2 << "Mex$\n";
43
44        }else if (currency2 == "euros"){
45
46            amount2 = amount * .82;
47
48            cout << amount << "$ is equal to " << amount2 << "€\n";
49
50        }
51
52    }else if (currency == "rupees"){
53        
54        if (currency2 == "dollars"){
55
56            amount2 = amount * .014;
57
58            cout << amount << "₹ is equal to " << amount2 << "$\n";
59
60        }else if (currency2 == "pesos"){
61
62            amount2 = amount * .28;
63
64            cout << amount << "₹ is equal to " << amount2 << "Mex$\n";
65
66        }else if (currency2 == "euros"){
67
68            amount2 = amount * .011;
69
70            cout << amount << "₹ is equal to " << amount2 << "€\n";
71
72        }
73
74    }else if (currency == "pesos"){
75
76            if (currency2 == "dollars"){
77
78                amount2 = amount * .050;
79
80                cout << amount << " Mex$ is equal to " << amount2 << "$\n";
81
82            }else if (currency2 == "rupees"){
83
84                amount2 = amount * 3.64;
85
86                cout << amount << " Mex$ is equal to " << amount2 << "₹\n";
87
88            }else if (currency2 == "euros"){
89
90                amount2 = amount * .041;
91
92                cout << amount << "Mex$ is equal to " << amount2 << "€\n";
93
94            }
95
96    }else if (currency == "euros"){
97
98        if (currency2 == "dollars"){
99
100            amount2 = amount * 1.22;
101
102            cout << amount << "€ is equal to " << amount2 << "$\n";
103
104        }else if (currency2 == "pesos"){
105
106            amount2 = amount * 24.39;
107
108            cout << amount << "€ is equal to " << amount2 << "Mex$\n";
109
110        }else if (currency2 == "rupees"){
111
112            amount2 = amount * 88.68;
113
114            cout << amount << "€ is equal to " << amount2 << "₹\n";
115
116        }
117
118    }else{
119
120        cout << "Invalid entry. (check spelling!)\n";
121
122    }
123
124}