I have a file that consists of data points, and numbers associated with those data points. For example, the file looks something like:
(1,2) 45
(3,4) 12
(23,9) 6 90
(3,5) 4 8
For each data point, I want to set variables "int num1" and "int num2." As you can see, sometimes I have to read an extra number attached to my data point. When there is no extra number, I set num1 and num2 to the value given. I have no problem getting the x and y from the coordinate, but I'm not sure how to check to make sure I'm getting both numbers. I feel like I have to use getline(), but I'm not sure where to go from there. The file is saved as "ins."
char parentheses1, parentheses2, comma;
int x, y, num1, num2;
ins >> parentheses1 >> x >> comma >> y >> parentheses2;
ins >> num1 >> num2;