Hi guys/gals,
Not sure if this forum answers novice questions or not, but I'm having a problem figuring out why this program sums everything to Zero. In the total_euros, which is the final "amount" displayed to the user after they input their values, it always shows Zero euros, instead of the converted amount. I know this is simple, but I cannot seem to figure out what I am doing wrong. Any suggestions?
Code:#include <iostream> using namespace std; #define SICKLES_TO_GALLEONS 17 #define KNUTS_TO_SICKLES 29 #define EUROS_TO_GALLEONS 60 #define COMMISSION 0.05 #define KNUTS_TO_GALLEONS (KNUTS_TO_SICKLES * SICKLES_TO_GALLEONS) #define EUROS_TO_KNUTS (EUROS_TO_GALLEONS / KNUTS_TO_GALLEONS) int main() { int galleons; int sickles; int knuts; int total_sickles; int total_knuts; // We first convert everything to Knuts //To turn from knut to euros, cout << "Enter amount of galleons\n"; cin >> galleons; cout << "Enter amount of sickles\n"; cin >> sickles; cout << "Enter amount of knuts\n"; cin >> knuts; total_sickles = (galleons * SICKLES_TO_GALLEONS) + sickles; cout << "Right now you have" <<total_sickles << "sickles\n"; total_knuts = (total_sickles * KNUTS_TO_SICKLES) + knuts; cout << "Right now you have" <<total_knuts << "Knuts"; // Then convert the nuts to euros (60--euros in 1 galleon/493knuts in one galleon), // so that's total nuts * (60/493) double total_euros = (total_knuts * EUROS_TO_KNUTS); cout << "For the amount you entered, you get" << total_euros <<"Euros"; return 0; }