-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathATM (C++)
27 lines (23 loc) · 854 Bytes
/
ATM (C++)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'''
Solution by Pandz18 in C++
Date : 2nd January 2021
'''
#include<iostream>
using namespace std;
int main()
{
float withdraw ;
float balance ;
cout<<"enter withdrawl amount as an integer only"<<endl;
cin>>withdraw;
cout<<"Enter your current Bank Balance";
cin>>balance;
if(fmod(withdraw,5)==0.0 && withdraw<=balance) //fmod() calulates the modulus of two float points
{
balance = balance-withdraw-0.50; //a reduction of 0.5 is due to witdrawl fees
cout<<"Balance ="<<balance;
} else {
cout<<"Unavailable to perform action "; //prints the message if the withdrawl amount is either more than the balance or not a multiple of 5
}
return 0;
}