?? card.cpp
字號:
#include "Card.h"
int Card::sum =0;
void Card::Cardin(char d[],int m)
{
strcpy(date[top],d);
money[top]=m;
sum+=m;
rest[top]=sum;
top++;
}
void Card::Cardout(char d[],int m)
{
if(sum>=m)
{
strcpy(date[top],d);
money[top]=-m;
sum-=m;
rest[top]=sum;
top++;
}
else
cout<<"警告:"<<d<<"交易失敗!您的戶面余額已不足!請續存!"<<endl;
}
void Card::disp()
{
int i;
cout<<" 日期 存入 取出 余額"<<endl;
for(i=0;i<top;i++)
{
cout.width(10); //首部縮進的長度
cout<<date[i];
if(money[i]<0)
{
cout.width(13);
cout<<-money[i]; //取錢
cout.width(9);
cout<<rest[i]<<endl;
}
else
{
cout.width(6);
cout<<money[i]; //存錢
cout.width (16);
cout<<rest[i]<<endl;
}
}
cout<<"您的帳戶余額為:"<<sum<<endl;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -