if else statement problems?

I am new to programming. The problem I am having is at the part of withdrawal. When I input the amount to be the exact for example I have total of 2.45. When I inputted 2.45. The programs just wont do anything. It should said I took out cents according to my total. I dont understand whyy its not working. Any help would be appreciated. I'll just post parts of it.

 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253`` ``````else if (x == "W" || x == "w"){ do{ validinput = true; cout << " Please enter the amount (in RM) => "; cin >> amount; if (cin.fail() || amount < 0) { cout << " ERROR: Invalid Coin Amount!"<< endl; std::cin.clear(); std::cin.ignore(std::numeric_limits::max(), '\n'); validinput = false; } }while(validinput == false); int tmp = amount*100; if(tmp%5 != 0 || amount > total){ cout << " ERROR: Invalid Withdrawal Amount!"; std::cin.clear(); std::cin.ignore(std::numeric_limits::max(), '\n'); } else { while(amount > 0){ if(fifty > 0 && amount >= 0.5){ fifty -= 1; c50 += 1; amount -= 0.5; } else if (twenty > 0 && amount >= 0.2){ twenty -= 1; c20 += 1; amount -= 0.2; } else if (ten > 0 && amount >= 0.1){ ten -= 1; c10 += 1; amount -= 0.1; } else if (five > 0 && amount >= 0.05){ five -= 1; c05 += 1; amount -= 0.05; } } cout << " Yes, Please collect your coins: "; cout << "\n 50c x " << c50 << endl; cout << " 20c x " << c20 << endl; cout << " 10c x " << c10 << endl; cout << " 5c x " << c05 << endl; } ``````
Sorry forgot my variables. Here are they

 ``1234567891011121314`` `````` string x, exit = "p"; srand (time(NULL)); int max = 10; int five = rand() % max; max -= five; int ten = rand() % max; max -= ten; int twenty = rand() % max; max -= twenty; int fifty = max; int j, a, k, q; double total = five*0.05 + ten*0.1 + twenty*0.2 + fifty*0.5, amount; double c05 = 0, c10 = 0, c20 = 0, c50 = 0; bool validinput = true;``````
Hi,

Please don't start a new topic about the same subject. Ultimately it's a time waster for those who reply: the same things will be said for both topics.

Could you quit this topic and carry on with the other one? Write a message here to that effect :+)

Cheers!
ohh sorry how do I delete this?
You can't, hence the idea of writing a message here, and providing a link to the other topic :+)