当前位置: 首页 > news >正文

带做网站绿标中国优化网

带做网站绿标,中国优化网,企业品牌维护,网站建设合同 下载在(1)的基础上进行改进 1:增加一个静态成员函数total,记录账户总金额和静态成员函数getTotal 2对不需要改变的对象进行const修饰 3多文件实现 account。h文件 #ifndef _ACCOUNT_ #define _ACCOUNT_ class SavingAccount {pri…

在(1)的基础上进行改进

1:增加一个静态成员函数total,记录账户总金额和静态成员函数getTotal

2对不需要改变的对象进行const修饰

3多文件实现

account。h文件

#ifndef _ACCOUNT_
#define _ACCOUNT_
class SavingAccount {private:int id;double rate;double balance;int lastdate;double accumulation;static double total;void record(int date, double amount);double accumulate(int date)const {return accumulation + balance * (date - lastdate);}
public:SavingAccount(int date, int id, double rate);int getid()const { return id; }double getbalance()const { return balance; }double getrate()const { return rate; }static double getTotal() { return total; }void deposit(int date, double amount);void withdraw(int date, double amount);void settle(int date);void show()const;
};
#endif

account。cpp文件

#include"account.h"
#include<cmath>
#include<iostream>
using namespace std;
double SavingAccount::total = 0;
SavingAccount::SavingAccount(int date, int id, double rate) :id(id), balance(0), rate(rate), lastdate(date)
, accumulation(0) {cout << date << "\t#" << id << "    " << endl;
}
void SavingAccount::record(int date, double amount) {accumulation = accumulate(date);lastdate = date;amount = floor(amount * 100 + 0.5) / 100;balance += amount;total += amount;cout << date << "\t#" << id << "\t" << amount << "\t" << balance << endl;
}
void SavingAccount::deposit(int date, double amount) {record(date, amount);
}
void SavingAccount::withdraw(int date, double amount) {if (amount > getbalance())cout << "余额不足" << endl;elserecord(date, -amount);
}
void SavingAccount::settle(int date) {double interest = accumulate(date) * rate / 365;if (interest != 0)record(date, interest);accumulation = 0;
}
void SavingAccount::show()const {cout << "#" << id << "\tbalance:" << balance;
}

1.cpp

#include"account.h"
#include<iostream>
using namespace std;
int main() {SavingAccount s1(1, 21325302, 0.0015);SavingAccount s2(1, 21325303, 0.0015);s1.deposit(5, 5000);s2.deposit(25, 10000);s1.deposit(45, 5500);s2.withdraw(60, 4000);s1.settle(90);s2.settle(90);s1.show();s2.show();}

http://www.shuangfujiaoyu.com/news/57729.html

相关文章:

  • 成都外贸网站建设最新发布的最新
  • wordpress画廊深圳市seo网络推广哪家好
  • 流量网站怎么做关键词排名关键词优化
  • 网站推广免费 优帮云无锡百度关键词优化
  • 网站开发的风险百度网盘网页版官网
  • 珠海市横琴新区建设环保局网站软文营销的优势
  • 常见的网页设计工具网络seo是什么意思
  • 成都网站建设销售网站的推广方案的内容有哪些
  • 浉河网站建设推广软件一键发送
  • 长沙 汽车 网站建设公司网站怎么优化
  • 昆山网站设计公司网页制作教程
  • 做名片素材网站百度知道官网手机版
  • 怎样做网站导购公司营销策划方案案例
  • b2c模式的电商网站发展趋势全国互联网营销大赛官网
  • 中小型网站建设精英微信指数查询
  • 网站建设与网页制作盒子模型优化大师免费版下载
  • 房地产开发公司网站当日网站收录查询统计
  • 做外贸做的很好的网站做网络营销推广的公司
  • 个人做分类信息网站网站权重查询工具
  • ppt制作网站怎么创建网站?
  • 免费 个人网站营销软文300字范文
  • 页面跳转的方式seo搜索排名优化公司
  • 做英文网站要请什么样的人做哈尔滨百度关键词优化
  • phpweb成品网站排版营销团队
  • asp.net小型网站开发郑州seo
  • 网站开发流程三部分网络优化器免费
  • 网站建设制作要学什么免费推广网站
  • 做系统网站建设全渠道营销案例
  • 不用写代码做网站软件google推广专员招聘
  • 花果园网站建设互联网推广员是做什么的