Untitled
unknown
plain_text
a year ago
1.1 kB
2
Indexable
Never
#include<iostream> using namespace std; void showBalance(double balance); double deposit(); double withdraw(double balance); int main() { double balance=0; int choice=0; do{ cout<<"Enter your Choice:\n"; cout<<"1. Show Balance\n"; cout<<"2. Deposit\n"; cout<<"3. Withdraw\n"; cout<<"4.Exit\n"; cin>>choice; switch(choice) { case 1:showBalance(balance); break; case 2:balance=balance+deposit(); showBalance(balance); break; case 3:withdraw(balance); showBalance(balance); break; case 4: cout<<"Thanks for visiting"; break; default:cout<<"Invalid"; } }while(choice != 4); return 0; } void showBalance(double balance) { cout<<"Your Balance is Rs"<<balance<<"\n\n"; } double deposit() { double amt=0; cout<<"Enter amount="; cin>>amt; if(amt>0) { return amt; } else { cout<"That invalid\n"; } } double withdraw (double balance) { double amt=0; cout<<"Enter amount"; cin>>amt; if(amt>0) { cout<<"Insufficient amount"; return 0; } return amt; }