每日打卡-21.2

leapssisbird / 2023-05-12 / 原文

一.问题描述

使用I/O流以文本方式打开上一题建立的文件test1.txt,读出其内容显示出来,看看是否正确。

二.设计思路

三.流程图

四.伪代码 

1

五.代码实现 

1#include<fstream>
#include<iostream>
using namespace std;
int main() {
	char ch;
	ifstream file2("text.txt");
	while (file2.get(ch))
		cout << ch;
	file2.close();
	return 0;
}