Ok so im new to c++, in fact im pretty new to programming so yeah bear with my lack of knowledge, im writing a basic math test program to show a uni at an interview that I can create simple console programs using c++. It involves the program asking the question, the user answering, if the user input via cin is equal to the equation stored in the integer then correct move onto next question, if not, try the question again, you have 3 lives then the program closes and you must restart and try again.

So its all good so far for example question 1:

int result;

//Question 1
std:: cout << "----------------------------" << std:: endl;
std:: cout << "-Question 1:\n" << std:: endl;

do
{
std:: cout << "What is the result of 35 + 47? ";
std:: cin >> result;
if (lives == 0)
{
std:: cout << "\n\tSorry, you have no more lives.. exiting program\n" << std:: endl;
return 0;
}
else if (result == 35 + 47)
{
std:: cout << "\n\tCorrect! Press return to continue...\n" << std:: endl;
std:: cin.get(); std:: cin.get();
break;
}
else
{
lives -= 1;
std:: cout << "\n\tIncorrect. You have " << lives << " More Lives."
" Please Try Again.\n" << std:: endl;
}
} while (result != 35 + 47);

---------------------------------------------------------------------------------------------------------------------

Works fine.

So I thought id create a money question to put some variety in there:

---------------------------------------------------------------------------------------------------------------------

float money_question;

//Question 6
std:: cout << "----------------------------" << std:: endl;
std:: cout << "-Question 6:\n" << std:: endl;

do
{
std:: cout << "If John buys 4 carrots each the price of 24 pence, and 2 onions at the "
"price of 67 pence each with a 5 pound note, how much change will he get? ";
std:: cin >> money_question;
if (lives == 0)
{
std:: cout << "\n\tSorry, you have no more lives.. exiting program\n" << std:: endl;
return 0;
}
else if (money_question == 5.00 - (0.24 * 4) - (0.67 * 2))
{
std:: cout << "\n\tCorrect! Press return to continue...\n" << std:: endl;
std:: cin.get(); std:: cin.get();
break;
}
else
{
lives -= 1;
std:: cout << "\n\tIncorrect. You have " << lives << " More Lives."
" Please Try Again.\n" << std:: endl;
}
} while (money_question != 5.00 - (0.24 * 4) - (0.67 * 2));

Now my problem is that the program will say that the cin input 2.70 is incorrect :S

I appreciate any help, sorry about the long post btw, i always write too much..