Background: So I basically googled projects for beginners for C++ and one recommendation was currency converter. So I decided to do this, at first I tried to do it by creating a class, objects etc but I got lost with constructors and header files etc but that's a story for another day. I am very new to programming and this is my first "project".
So I decided to go the simple route and did this:
#include <iostream>
int main(){
double euro;
//creating all the variables and conversions
double eur2dol = euro * 1.13;
double eur2pound = euro * 0.84;
double eur2rup = euro * 84.49;
double eur2yuan = euro * 7.2322769;
double eur2btc = euro * 0.0000237;
double eur2eth = euro * 0.00029956;
// creating an array with the name of the currency i am converting to
std::string curname[6] = { " Dollars\n", " Pounds\n", " Rupees\n", " Yuan\n", " Bitcoin\n", " Etherium\n"};
// creating an array with the conversions i want to do
double currencies[6] = { eur2dol, eur2pound, eur2rup, eur2yuan, eur2btc, eur2eth };
//accepting input from the user
std::cout << "Amount in euros: " << std::endl;
std::cin >> euro;
// for loop to loop through every item in the currencies array and the corresponding name of the currency from the curname array
for(int i = 0; i < 5; i++){
std::cout << euro << " Euro is " << currencies[i] << curname[i];
};
return 0;
}
Now, I know there is no point in doing this other than practicing because the values constantly change but I am getting the same result no matter the value I type in and in scientific form.
How can I fix it so i get the correct result and what is the problem?