게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
아래글에 이어서 c++ 과제 도와주세요~!~!~
게시물ID : programmer_13244짧은주소 복사하기
작성자 : 안녕하세
추천 : 0
조회수 : 433회
댓글수 : 5개
등록시간 : 2015/09/12 17:57:14
옵션
  • 본인삭제금지
친절한 답변해주셔서 감사합니다!!!!
대충 고쳐보긴했어요 ㅠㅠ
 
이제 여기서 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;
  }
 }
}
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호