ait-survey

read_text

Feb 27th, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3. #include<iomanip>
  4. #include<sstream>
  5.  
  6. using namespace std;
  7.  
  8. int main(int argc, char** argv)
  9. {
  10.  
  11.     if(argc!=2)
  12.     {
  13.         fprintf(stderr,"Usage: %s\n(1)Input_filename\n",argv[0]);
  14.         exit(1);
  15.     }
  16.    
  17.     ifstream ifs(argv[1]);
  18.     string line;
  19.  
  20.     while(getline(ifs,line))
  21.     {
  22.  
  23.         int a,b;
  24.  
  25.         istringstream is(line);
  26.        
  27.         is  >> a
  28.             >> b;
  29.        
  30.         cout<< a <<" "<< b <<endl;
  31.  
  32.     }
  33.     ifs.close();
  34.    
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment