上一页 1 ··· 50 51 52 53 54
摘要: 1 #include <iostream> 2 #include <string> 3 #include <vector> 4 #include <fstream> 5 #include <sstream> 6 7 using namespace std; 8 9 void readFile1(void) 10 { 11 ifstream ifs("test.txt"); 12 if (!ifs) 13 {cout << "File open error!" << end 阅读全文
posted @ 2013-04-23 15:07 robotke1 阅读(1491) 评论(0) 推荐(0)
摘要: 1 #include <iostream> 2 #include <string> 3 #include <vector> 4 #include <fstream> 5 6 using namespace std; 7 8 int main(int argc, char *argv[]) 9 {10 ifstream ifs("test.txt");11 12 ifs.seekg(0, ios::end); //设置文件指针到文件流的尾部13 streampos pos = ifs.tellg(); //读取文件指针的位置14 阅读全文
posted @ 2013-04-23 13:37 robotke1 阅读(888) 评论(0) 推荐(0)
摘要: View Code 1 #include <iostream> 2 #include <string> 3 #include <vector> 4 #include <fstream> 5 6 using namespace std; 7 8 int main(int argc, char *argv[]) 9 {10 int iArray[] = {23, 45, 57, 68, 23, 46, 68};11 vector<int> iVec(iArray, iArray + sizeof(iArray) / sizeof(*iAr 阅读全文
posted @ 2013-04-23 12:02 robotke1 阅读(4135) 评论(0) 推荐(0)
摘要: 1 ostringstream oss; 2 string city("ZhuHai"); 3 string name("Robot"); 4 string phoneNumber("10086"); 5 6 oss << city << " "; 7 cout << oss.str() << endl; // 输出ZhuHai 8 oss << name << " "; 9 cout << oss.str() 阅读全文
posted @ 2013-04-23 11:39 robotke1 阅读(427) 评论(0) 推荐(0)
上一页 1 ··· 50 51 52 53 54