摘要: 将输入内容放入流中,并返回。1 #ifndef _GET_H2 #define _GET_H3 4 #include <iostream>5 6 std::istream& get(std::istream& in);7 8 9 #endif 1 #include "get.h" 2 3 std::istream& get(std::istream& in) 4 { 5 6 int ival; 7 8 while(in >> ival, !in.eof()) 9 {10 11 if(in.bad())12 throw. 阅读全文
posted @ 2012-12-23 16:31 uniquews 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <fstream> 3 #include <string> 4 #include <vector> 5 6 using namespace std; 7 8 void process(string s) 9 {10 11 cout << s << endl;12 }13 14 int main()15 16 {17 vector <string> files;18 files.push_back("one.txt");19 f 阅读全文
posted @ 2012-12-23 11:43 uniquews 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include<fstream> 3 #include<string> 4 5 using namespace std; 6 7 int main() 8 9 {10 ofstream outfile("test.txt");//创建新的文件11 outfile << "hello file!";//这些文字进入到流中,这个流被写道文件里12 outfile.close();//把这个文件关闭了13 14 15 string file("one.t 阅读全文
posted @ 2012-12-23 11:16 uniquews 阅读(178) 评论(0) 推荐(0) 编辑