Advertisement
MUstar

IoT C++ 09/12 - Project1_account.cpp

Sep 12th, 2017
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.96 KB | None | 0 0
  1. #include <iostream>
  2. #include<string.h>
  3. #include "account.h"
  4. using namespace std;
  5.  
  6. BankAccount::BankAccount(const char* client, const char *num, double bal)
  7. {
  8.     strcpy(name,client);
  9.     strcpy(acctnum,num);
  10.     balance=bal;
  11. }
  12.  
  13. void BankAccount::show(void) const
  14. {
  15.     cout<<"-----------------------------"<<endl;
  16.     cout<<"고객이름 : "<<name<<endl;
  17.     cout<<"계좌번호 : "<<acctnum<<endl;
  18.     cout<<"현재잔액 : "<<balance<<endl;
  19.     cout<<"-----------------------------"<<endl<<endl;
  20. }
  21.  
  22. void BankAccount::deposit(double cash)
  23. {
  24.     balance+=cash;
  25.     cout<<">>잔액 : "<<balance<<"<<"<<endl;
  26.     cout<<">>정상으로 처리되었습니다<<"<<endl<<endl;
  27. }
  28.  
  29. void BankAccount::withdraw(double cash)
  30. {
  31.     if(balance>=cash)
  32.     {
  33.         balance-=cash;
  34.         cout<<">>잔액 : "<<balance<<"<<"<<endl;
  35.         cout<<">>정상으로 처리되었습니다<<"<<endl<<endl;
  36.     }
  37.     else
  38.     {
  39.         cout<<">>잔액 : "<<balance<<"<<"<<endl;
  40.         cout<<">>잔액이 부족합니다.<<"<<endl;
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement