Guest User

Untitled

a guest
Jul 16th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include<iostream.h>
  2. int main()
  3.  
  4. {
  5. double bankbalance=253.85;
  6. int transactioncount=0;
  7. double transaction=99999;
  8.  
  9. while(transaction!=0)
  10. {
  11. cout<<"Your balance is now "<<bankbalance<<endl;
  12. cout<<"Please enter amount of transaction"<<endl;
  13. cin>>transaction;
  14. if(bankbalance+transaction<0)
  15. {
  16. cout<<"Amount exceeds the limit."<<endl;
  17. bankbalance=bankbalance-5;
  18. transactioncount++;
  19. }
  20.  
  21. else
  22. bankbalance=bankbalance+transaction;
  23. if(transaction!=0)
  24. transactioncount++;
  25. }
  26.  
  27. cout<<"Your ending balance: "<<bankbalance<<endl;
  28. cout<<"Number of transactions "<<transactioncount<<endl;
  29.  
  30. return 0;
  31.  
  32.  
  33.  
  34. }
Add Comment
Please, Sign In to add comment