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