#include <iostream>
#include <stdlib.h>
#include <conio.h>
using std::cin; using std::cout; using std::endl;
class ACC
{
public:
int accID;
char pw[5];
char name[20];
int bal;
void menu(int &sel);
void mkacc();
void save();
void withdraw();
void balance();
};
int main()
{
ACC reval = {1111};
int choice;
while(1)
{
reval.menu(choice);
switch(choice)
{
case 1:
reval.mkacc();
break;
case 2:
reval.save();
break;
case 3:
reval.withdraw();
break;
case 4:
reval.balance();
break;
case 5:
exit(1);
}
}
return 0;
}
void ACC::menu(int &sel)
{
system("cls");
cout << "\n[ 메 뉴 선 택 ]\n\n";
cout << "1. 계좌등록\n";
cout << "2. 입 금\n";
cout << "3. 출 금\n";
cout << "4. 잔액조회\n";
cout << "5. 종 료\n";
cout << "\n\n선택 : [ ]\b\b";
cin >> sel;
}
void ACC::mkacc()
{
system("cls");
cout << "\n\n\t\t[ 계 좌 등 록 ]\n\n";
cout << "계좌번호 : " << accID << endl;
cout << "이 름 : ";
cin >> name;
cout << "비밀번호(4자리) : ";
cin >> pw;
cout << "입 금 액 : ";
cin >> bal;
cout << "\n\n\n\t\t계좌 등록 완료!" << "\n\n\t\t아무키나 누르면 메뉴로 돌아갑니다.";
getch();
}
void ACC::save()
{
system("cls");
int inmoney;
cout << "\n\n\t[ 입\t금 ]\n\n";
cout << "입금액 : ";
cin >> inmoney;
cout << "\n\n\n\t\t[" << inmoney << "]원 입금완료!\n\n";
cout << "\t\t아무키나 누르면 메뉴로 돌아갑니다.";
bal += inmoney;
getch();
}
void ACC::withdraw()
{
system("cls");
int outmoney;
cout << "\n\n\t[ 출\t금 ]\n\n";
cout << "출금액 : ";
cin >> outmoney;
if(outmoney <= bal)
{
cout << "\n\n\n\t\t[" << outmoney << "]원 출금 완료!\n\n";
bal -= outmoney;
}
else
{
cout << "\n\n\n\t\t잔액이 부족합니다.\n\t\t";
cout << "[" << name << "]회원님의 잔액은 [" << bal << "]원 입니다.";
}
cout << "\n\n\t\t아무키나 누르면 메뉴로 돌아갑니다.";
getch();
}
void ACC::balance()
{
system("cls");
cout << "\n\n\t[ 잔 액 조 회 ]\n\n";
cout << "계좌번호 : " << accID << endl;
cout << "\n\n\n\t\t[" << name << "]회원님의 잔액은 [" << bal << "]원 입니다.\n\n";
cout << "\t\t아무키나 누르면 메뉴로 돌아갑니다.";
getch();
}