I am trying to read (x,y) floating point values from a txt file in C++. The numbers are separated by a space. The ith number and the i+1th number make the (x,y) coordinates. So index positions 0 and 1 would be the first (x,y) pair and index positions (1,2) would be the next (x,y) pair.
This is what I have done but I am not sure how I can save them as floats.
ifstream randomFile;
string content;
randomFile.open("random.txt");
if(randomFile.is_open()) {
    while(getline(randomFile,content)){
        randomFile >> content;
    }
    randomFile.close();
}
 
     
     
    