ofstream是从内存到硬盘,ifstream是从硬盘到内存,其实所谓的流缓冲就是内存空间; //ofstream & ifstream inherit from istream class and ostream,so they support all the method that iostream class has,like getline(istream,string)->getline(ifstream),cin>> -> fin>>,and so
#include <iostream>#include <fstream>#include <string> using namespace std; //输出空行void OutPutAnEmptyLine(){ cout << "\n";} //读取方式: 逐词读取, 词之间用空格区分//read data from the file, Word By Word//when used in this manner, we'll get