7.1.2
来源:互联网 发布:vb中truefalse什么意思 编辑:程序博客网 时间:2024/06/05 00:47
7.2
#ifndef CP5_ex7_02_h#define CP5_ex7_02_h#include <string>struct Sales_data { std::string isbn() const { return bookNo; }; Sales_data& combine(const Sales_data&); std::string bookNo; unsigned units_sold = 0; double revenue = 0.0;};Sales_data& Sales_data::combine(const Sales_data& rhs){ units_sold += rhs.units_sold; revenue += rhs.revenue; return *this;}#endif
7.3
#include "ex7_02.h"#include <iostream>using std::cin; using std::cout; using std::endl;int main(){ Sales_data total; if (cin >> total.bookNo >> total.units_sold >> total.revenue) { Sales_data trans; while (cin >> trans.bookNo >> trans.units_sold >> trans.revenue) { if (total.isbn() == trans.isbn()) total.combine(trans); else { cout << total.bookNo << " " << total.units_sold << " " << total.revenue << endl; total = trans; } } cout << total.bookNo << " " << total.units_sold << " " << total.revenue << endl; } else { std::cerr << "No data?!" << std::endl; return -1; } return 0;}
7.4
#include <string>class Person { std::string name; std::string address;};
7.5
#include <string>class Person { std::string name; std::string address;public: std::string & get_name() const { return name; } std::string & get_addr() const { return address; }};
0 0
- 7.1.2
- 7.1.2
- SnagIt 7.1.2
- 7.1.2 函数说明符
- 7.1.2 实数检查
- 7.1.2 磁盘设备管理
- 7.1.2(最大乘积)
- 7.1.2 最大乘积
- 7.1.2 最大乘积
- 7.1.2 运行错误
- 《Spring 技术手册》7.1.2
- 例题7.1.2,最大乘积
- 7.1.2 C++关键字 const
- 7.1线程2015/8/2
- 7.1.Zeng_Cache(2) --- 缓存原理
- 算法导论 练习题 7.1-2
- 第七章 7.1.2节练习 & 7.1.3节练习
- 7.1
- tensorflow GTX1070 安装
- Android 的这种浮动的框框式怎么实现的,并没有在java代码里看到这样的activty啊
- Volley StringRequest和JSONObjectRequest的使用
- [Http]post 相比get 有很多优点,为什么现在的HTTP通信中大多数请求还是使用get?
- 02JavaScript程序
- 7.1.2
- imooc-1
- jvm工作机制
- EditText界面显示效果疑问?
- FZU1075 之 分解素因子
- Java Socket应用
- 微信开发就是这么简单
- 通用 Intent
- 火狐浏览器使用RESTClient发送post请求方法