- 首頁(yè)|
- 網(wǎng)校|
- 焚題庫(kù)|
- APP |
- 微信公眾號(hào)
六、程序設(shè)計(jì)題(本大題共1小題,共10分)
53.設(shè)計(jì)一個(gè)Bank類,實(shí)現(xiàn)銀行某賬號(hào)的資金往來(lái)賬目管理,包括建賬號(hào)、存入、取出等。解:Bank類包括私有數(shù)據(jù)成員top(當(dāng)前賬指針),date(日期),money(金額),rest(余額)和sum(累計(jì)余額)。有三個(gè)成員函數(shù)bankin()(處理存入賬),bankout()處理取出賬)和disp()(輸出明細(xì)賬)請(qǐng)完成函數(shù)的實(shí)現(xiàn)。
本題程序如下:
#include<stdio.h>
#include<string.h>
#define Max 100
class Bank
{
int top;
char date[Max][10];//日期
int money[Max];//金額
int rest[Max];//余額
static int sum;//累計(jì)余額
public:
Bank(){top=0;}
void bankin(char d[ ],int m){…}
void bankout(char d[ ],int m){…}
void disp(){…};
} ;