#include <iostream>
using namespace std;
int count;
typedef struct _BankBook{
int ID;
char *name;
int money;
}BankBook;
void Deposit(BankBook **p){
int id, amount;
cout<<"[입\t금]"<<endl;
cout<< "계좌 아이디:";
cin >>id;
cout << " 입금 액";
cin >>amount;
p[id]->money+=amount;
cout<<"입금 완료" <<endl;
}
void Withdraw(BankBook **p){
int id, amount;
cout<<"[출\t금]"<<endl;
cout<< "계좌 아이디:";
cin >>id;
cout << " 출금 액";
cin >>amount;
p[id]->money+=amount;
cout<<"출금 완료" <<endl;
}
BankBook* Open(){
BankBook *p=new BankBook;
cout<< "NAME:";
cin >> p->name;
p-> money=0;
p->ID = ::count;
return p;
}
void Info(){
}
int Menu(){
int choice;
cout<<"-----------"<<endl;
cout<<"1. 입금\n2. 출금\n3. 계좌정보 출력\n4. 종료\n 5. 계좌개설"<<endl;
cin >> "선택" >>choice;
return choice;
}
int main()
{
BankBook * p=NULL;
BankBook *arr=new BankBook[10]; //arr 타입 포인터 배열.
int choice=Menu();
switch(choice){
case 1:
Deposit(arr);
break;
case 2:
Withdraw(arr);
break;
case 3:
Info(arr);
break;
case 4:
return 0;
case 5:
p=Open();
arr[::count++]= p;
break;
}
}
댓글 달기