친절한 답변해주셔서 감사합니다!!!!
대충 고쳐보긴했어요 ㅠㅠ
이제 여기서 credit(현재 잔액에 일정액을 더함) 과 debit(빚)을 만들어야 하는데요
private에다 넣어야 하나요? public에다 넣어야 하나요? 제생각은 public에 넣어야 할꺼 같은데.. 아닌가요? ㅠㅠ
#include <iostream>
using namespace std;
class account
{
private:
int balance;
public:
void setBalance()
{
cin >> balance;
if (balance < 0)
{
cout << "Error : Initial balance cannot be negative" << endl;
balance = 0;
}
}
void getBalance()
{
cout << balance;
}
};
void main()
{
int a;
account account1, account2;
cout << "welcome to the bank!" << endl;
cout << endl;
cout << "Enter the initial balance" << endl;
cout << "account 1 : ";
account1.setBalance();
cout << "account 2 : ";
account2.setBalance();
cout << endl;
cout << endl;
while (1)
{
cout << "1.Balance 2.Debit 3.Deposit 4.Withdrawal" << endl << "Number enter : ";
cin >> a;
switch (a)
{
case 1: //balance
break;
case 2: //debit
break;
case 3: //deposit
break;
case 4: //withdrawal
break;
}
}
}