C++ COUT CIN 重定向

 1 #include <iostream>
 2 #include <string>
 3 #include <sstream>
 4 #include <fstream>
 5 
 6 //#define LOCAL
 7 
 8 
 9 using namespace std;
10 
11 int main()
12 {
13     #ifdef LOCAL
14     fstream cout("data.out");
15     #endif // LOCAL
16 
17     string s1 = "50 60";
18     stringstream ss;
19     ss<<s1;
20     ss<<s1;
21     int n = 0;
22     ss >> n;
23     cout<<n<<endl;
24     return 0;
25 }

 

posted @ 2016-01-02 12:21  永久指针  阅读(806)  评论(0编辑  收藏  举报