📄 obtfunc.cpp
字号:
#include "head.h"
void Rate ::update(double current) //利率更新
{
dRate = current;
}
Account :: Account() : Rate() ,Tel(), LastDay()
{
cout << "使用默认值创建帐户." << endl;
money = 0;
strcpy(ID,"000000000000000");
strcpy(name , "新帐户");
strcpy(password , "123456");
pointer = NULL;
}
Account :: Account(char *mName ,double mMon ,char *mID , int mYear ,int mMonth , int mDay,char * mPass , Account *p,double mRate,Telephone tTel)
:LastDay(mYear,mMonth,mDay),Rate(mRate),Tel(tTel)
{
strcpy(name , mName);
money = mMon;
strcpy(ID, mID);
strcpy(password , mPass);
pointer = p;
}
Account :: Account(char *mName ,double mMon ,char *mID , int mYear ,int mMonth , int mDay,char * mPass ,char * mobile,double a)
:LastDay(mYear,mMonth,mDay),Tel(mobile,a)
{
strcpy(name , mName);
money = mMon;
strcpy(ID, mID);
strcpy(password , mPass);
}
void Account ::UpdatePro()
{
Date now;
cout << "请正确输入当前 年 月 日 : ";
cin >> now.year >> now.month >> now.day;
double period;
period = ( now.year * 365 + now.month * 30.5 + now.day ) - (LastDay.year * 365 + LastDay.month * 30.5 + LastDay.day);
money = money * (1 + period / 365 * rate());
LastDay = now;
}
ostream & operator << (ostream & os,Date date)
{
os << date.year << "年" << date.month << "月" << date.day << "日";
return os;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -