Practice(Beginner) problem ATM why is it wrong?

#include
#include <stdio.h>
#include <math.h>
using namespace std;

int main()
{
int wid;
double bal;

cin>>wid>>bal;
if(bal>=wid && bal+0.5>=wid)
{
if (wid%5==0)
{
bal=bal-wid-0.5;
}
}
printf("%.2f" ,bal);
return 0;
}

Correct Code would be
#include<bits/stdc++.h>
using namespace std;
int main()
{
int amount;
float balance,left;
cin>>amount;
cin>>balance;
if((amount<int(balance))&&(amount%5==0))
{
left=balance-(amount+0.5);
printf("%0.2f",left);
}
else
printf("%0.2f",balance);
return 0;
}

first calculate
balance=balance-0.5(transcation charges needed);
and then if your balance>=withdraw
then make your trancation
else
transcation not possible

apply this concept to your code