Advertisement
cd62131

Ignore new line

Feb 15th, 2014
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <limits>
  4. using namespace std;
  5. int main() {
  6.   ifstream ifs("a.txt");
  7.   int a, b, c;
  8.   ifs >> c;
  9.   cout << c << endl;
  10.   ifs.ignore(numeric_limits<streamsize>::max(), '\n');
  11.   char d;
  12.   while (ifs >> a >> d >> b)
  13.     cout << a << ' ' << b << endl;
  14.   ifs.close();
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement