jasonpogi1669

Input Numbers until End of File (EOF) C++

Jun 12th, 2022
803
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. void test_case() {
  5.     string s = "";
  6.     while(getline(cin, s)) {
  7.         int a = (s[0] - '0');
  8.         int b = (s[2] - '0');
  9.         cout << a << " " << b << "\n";
  10.     }
  11. }
  12.  
  13. int main() {
  14.     ios::sync_with_stdio(false);
  15.     cin.tie(0);
  16.     int T = 1;
  17.     //cin >> T;
  18.     for(int tc = 1; tc <= T; tc++) {
  19.         test_case();
  20.     }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment