what is wrong with this ATM program in CPP?


using namespace std;

double withDraw(double x,double total){

if((int)x%5 == 0 && total > x){
	double temp = total;
	temp -= x;
	temp -= 0.50;
	cout << setprecision(2) << fixed;

	return temp;


else if ((int)x%5 == 0 && total < x){
	cout << "insufficient funds in account:\n" << endl;
	cout << "total account balance :\n" << total;

else {
	cout << "enter valid number:\n";
	cout << "total account balance: \n" << total << endl;


int main (){
double with;
double total;
cout <<“enter total amount\n”;
cin >> total;

cout << "please enter withdrawal amout\n";
cin >> with;

cout << setprecision(2) ;
cout  << withDraw(with,total) << endl;

return 0; 


Don’t copy paste your code like this. Use ideone or pastebin.

Seems like you are new to the world of competitive programming.You shouldn’t print any extra statements which are not asked to print in problem statement.Just printing answer is enough as they give verdict by comparing your output and correct output.Remove extra statements in your code like printing “total account balance” and enter valid number.