在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
假设有一个叫 data.txt 的文件, 它包含以下内容:
Fry: One Jillion dollars.
[Everyone gasps.] Auctioneer: Sir, that's not a number. 数据读取, 测试 。 以下就是基于 data.txt 的数据读取操作:
#include <iostream>
#include <fstream> #include <string> using namespace std; //输出空行 void OutPutAnEmptyLine() } 输出结果为: Read from file: Fry: Read from file: One Read from file: Jillion Read from file: dollars. Read from file: [Everyone Read from file: gasps.] Read from file: Auctioneer: Read from file: Sir, Read from file: that's Read from file: not Read from file: a Read from file: number. Read from file: 数据读取, Read from file: 测试 Read from file: 。 Read from file: Fry: One Jillion dollars. Read from file: [Everyone gasps.] Read from file: Auctioneer: Sir, that's not a number. Read from file: 数据读取, 测试 。 Read from file: Fry: One Jillion dollars. Read from file: [Everyone gasps.] Read from file: Auctioneer: Sir, that's not a number. Read from file: 数据读取, 测试 。 Error opening dataFUNNY.txt for input Press any key to continue |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论