fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <utility>
  4.  
  5. int main() {
  6. std::pair<int, int> p; //for the current pair
  7. char comma; //For dumping commas into
  8. std::vector<std::pair<int, int>> v;
  9.  
  10. while(std::cin >> p.first >> comma >> p.second) {
  11. v.push_back(p);
  12. }
  13.  
  14. for(auto it : v) {
  15. std::cout << "(" << it.first << ", " << it.second << ")" << std::endl;
  16. }
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 15240KB
stdin
2,16 16,134 15,631
stdout
(2, 16)
(16, 134)
(15, 631)