blob: 5e965ea67c878f6b02c7e41f31a71b51f3128261 (
plain) (
blame)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
#ifndef CURRENCY_HELPER_HPP
#define CURRENCY_HELPER_HPP
#include "Helper.hpp"
#include <Windows.h>
double CurrencyConversion(double& Money);
void CurrencyList();
double Dollars_USD(double& Money);
double Euro_EUR(double& Money);
double Yen_JPY(double& Money);
double Pound_GBP(double& Money);
double Rand_ZAR(double& Money);
double CurrencyConversion(double& Money)
{
system("cls");
int Selection = 0;
CurrencyList();
Selection = InputSelectionInt("What type of currency are you looking to convert from? :");
Money = InputDouble("How much do you have?");
switch (Selection)
{
case 1: Dollars_USD(Money);
break;
case 2: Euro_EUR(Money);
break;
case 3: Yen_JPY(Money);
break;
case 4: Pound_GBP(Money);
break;
case 5: Rand_ZAR(Money);
break;
default:
std::cout << "Invalid input, please try again!" << std::endl;
}
return Money;
}
double Dollars_USD(double& Money)
{
int UserSelect1;
Prompts("1.Dollar to Euro\n2.Dollar to Yen\n3.Dollar to Pound\n4.Dollar to Rand\n");
UserSelect1 = InputSelectionInt("What would you like to convert your U.S Dollars to? :");
switch (UserSelect1)
{
case 1: Money *= 0.93995; //Dollars to Euro
std::cout << "(EUR)" << Money << std::endl;
break;
case 2: Money *= 153.225; //Dollars to Yen
std::cout << "(JPY)" << Money << std::endl;
break;
case 3: Money *= 0.80337; //Dollars to Pound
std::cout << "(GBP)" << Money << std::endl;
break;
case 4: Money *= 18.898; //Dollars to Rand
std::cout << "(ZAR)" << Money << std::endl;
break;
default:
std::cout << "Invalid input, please try again!" << std::endl;
}
return Money;
}
double Euro_EUR(double& Money)
{
int UserSelect2 = 0;
Prompts("1.Euro to Dollar\n2.Euro to Yen\n3.Euro to Pound\n4.Euro to Rand\n");
UserSelect2 = InputSelectionInt("What would you like to convert your European Euros to? :");
switch (UserSelect2)
{
case 1: Money *= 1.064; //Euros to Dollars
std::cout << "$" << Money << std::endl;
break;
case 2: Money *= 163.025; //Euros to Yen
std::cout << "(JPY)" << Money << std::endl;
break;
case 3: Money *= 0.8547; //Euros to Pound
std::cout << "(GBP)" << Money << std::endl;
break;
case 4: Money *= 20.102; //Euros to Rand
std::cout << "(ZAR)" << Money << std::endl;
break;
default:
std::cout << "Invalid input, please try again!" << std::endl;
}
return Money;
}
double Yen_JPY(double& Money)
{
int UserSelect3 = 0;
Prompts("1.Yen to Dollar\n2.Yen to Euro\n3.Yen to Pound\n4.Yen to Rand\n");
UserSelect3 = InputSelectionInt("What would you like to convert your Japanese Yens to? :");
switch (UserSelect3)
{
case 1: Money *= 0.0065; //Yen to Dollars
std::cout << "$" << Money << std::endl;
break;
case 2: Money *= 0.0061; //Yen to Euros
std::cout << "(EUR)" << Money << std::endl;
break;
case 3: Money *= 0.0052; //Yen to Pound
std::cout << "(GBP)" << Money << std::endl;
break;
case 4: Money *= 0.123; //Yen to Rand
std::cout << "(ZAR)" << Money << std::endl;
break;
default:
std::cout << "Invalid input, please try again!" << std::endl;
}
return Money;
}
double Pound_GBP(double& Money)
{
int UserSelect3 = 0;
Prompts("1.Pound to Dollar\n2.Pound to Euro\n3.Pound to Yen\n4.Pound to Rand\n");
UserSelect3 = InputSelectionInt("What would you like to convert your British Pounds to? :");
switch (UserSelect3)
{
case 1: Money *= 1.244; //Pound to Dollars
std::cout << "$" << Money << std::endl;
break;
case 2: Money *= 1.169; //Pound to Euros
std::cout << "(EUR)" << Money << std::endl;
break;
case 3: Money *= 190.755; //Pound to Yen
std::cout << "(JPY)" << Money << std::endl;
break;
case 4: Money *= 23.513; //Pound to Rand
std::cout << "(ZAR)" << Money << std::endl;
break;
default:
std::cout << "Invalid input, please try again!" << std::endl;
}
return Money;
}
double Rand_ZAR(double& Money)
{
int UserSelect4 = 0;
Prompts("1.Rand to Dollar\n2.Rand to Euro\n3.Rand to Yen\n4.Yen to Pound\n");
UserSelect4 = InputSelectionInt("What would you like to convert your South African Rands to?: ");
switch (UserSelect4)
{
case 1: Money *= 0.0529; //Rand to Dollars
std::cout << "$" << Money << std::endl;
break;
case 2: Money *= 0.497; //Rand to Euros
std::cout << "(EUR)" << Money << std::endl;
break;
case 3: Money *= 8.111; //Rand to Yen
std::cout << "(JPY)" << Money << std::endl;
break;
case 4: Money *= 0.0425; //Rand to Pound
std::cout << "(GBP)" << Money << std::endl;
break;
default:
std::cout << "Invalid input, please try again!" << std::endl;
}
return Money;
}
void CurrencyList()
{
std::cout << "Welcome to the Currency Exchange\n\n"
<< "1. U.S Dollars(USD)\n"
<< "2. European Euros(EUR)\n"
<< "3. Japanese Yens(JPY)\n"
<< "4. British Pounds\n"
<< "5. South African Rand(ZAR)\n" << std::endl;
}
#endif
|