2011年11月5日星期六

stream:有点难

input file stream  
ifstream input_data;input_data.open("input_data");
input_data>>.......;input_data.close();
output file stream
ofstream output_data;output_data.open("output_data");
output_data<<......;output_data.close();

cin is a derived class from istream;cout is derived from ostream;

stringstream
A very common use of string streams is to accept input one line at a time and then to analyze it further.like 9:30 pm;
先一股脑全读进来,然后转换成istringstream,慢慢处理

没有评论:

发表评论