题目:重写7.1.1节的书店程序(P229),从一个文件中读取交易记录。将文件名作为一个参数传递给main。

 #include <iostream>
#include <fstream>
#include "test.h"
using namespace std; int main(int argc, char** argv)
{
ifstream input(argv[]);
Sales_data total;
if (read(input, total)) {
Sales_data trans;
while (read(input, trans)) {
if (total.isbn() == trans.isbn()) {
total.combine(trans);
}
else {
print(cout, total) << endl;
total = trans;
}
}
print(cout, total) << endl;
}
else {
cerr << "No data?!" << endl;
}
return ;
}

最新文章

  1. Singleton Design Pattern
  2. errorlevel
  3. CSS3弹性盒模型flexbox完整版教程
  4. smartUpload组件单文件下载
  5. [OpenXml] Generate excel in memory and dump to file
  6. 教程-Python实例-发送邮件功能
  7. 【转】(DT系列二)device tree的书写规范
  8. B - Dining - poj 3281(最大流)
  9. Linux usb子系统(三):通过usbfs操作设备的用户空间驱动
  10. 事件总线帧---Otto
  11. js操作符+和()
  12. go redigo的简单操作
  13. python的基本流程控制
  14. pycharm安装配置
  15. JVM-crash查看hs_err_pid.log日志
  16. H3路由器映射端口到外网
  17. Vue.js 技术揭秘(学习) 深入响应式原理 nextTick外传
  18. iOS scrollsToTop属性失效
  19. 怎样从外网访问内网MySQL数据库?
  20. WINDOWS 逻辑坐标 设备坐标 屏幕坐标 客户区坐标

热门文章

  1. android 中动画
  2. 【奇偶剪枝】【HDU1010】Tempter of the Bone
  3. asp.net 2.0 Session丢失问题
  4. IntPtr问题
  5. Sql Server数据库基础
  6. 使用CRT定位内存泄漏
  7. int指令(软件中断指令)
  8. BZOJ 1564: [NOI2009]二叉查找树( dp )
  9. VB execl文件后台代码,基础语法
  10. mysql性能优化学习笔记(3)常见sql语句优化