List 1-3 CAccountクラスのPay関数,Deposit関数,Refer関数
1: int CAccount::Pay(int lAmount)
2: {
3: // 支払い可能かどうかを調べる。
4: if(lRemainder - lAmount >= 0)
5: {
6: // 残高から出金を減ずる。
7: lRemainder = lRemainder - lAmount;
8: printf("出金 : %ld \n", lAmount);
9: return SUCCESS;
10: }
11: else
12: {
13: printf("出金 : %ld [残高不足]\n",lAmount);
14: return FAIL;
15: }
16: }
17:
18: int CAccount::Deposit(int lAmount)
19: {
20: // 残高に入金を加算する。
21: lRemainder = lRemainder + lAmount;
22: printf("入金 : %ld \n", lAmount);
23: return SUCCESS;
24: }
25:
26: long CAccount::Refer()
27: {
28: // 残高を照会する。
29: printf("残高 : %ld\n",lRemainder);
30: return lRemainder;
31: }