I am reading coordinates from a text file. For example "0 50 100". I am keeping my text file in a string vector. I want to get 0 and 50 and 100 seperately. I thought that I can make it as getting a string between 2 spaces then convert it to integer using stoi. But I couldn't achieve to get a string between 2 spaces seperately. I shared what I've tried. I know that this is not correct. Can you please help me to find my solution?
Sample text input: Saloon 4 0 0 50 0 50 100 0 100. (4 means that saloon has 4 points. Ex: First two integer after 4 shows (x1,y1))
for (int j = 2; j < n * 2 + 2; j++){
size_t pos = apartmentInfo[i].find(" ");
a = stoi(apartmentInfo[i].substr(pos + j+1,2));
cout << "PLS" << a<<endl;
}