Well, a solution(probably easyer) would be to just read the whole line first, then separate the line in 3 parts, based on the ",".
Then you convert the 2 string variables to floats using atof
Reference to atof = http://www.cplusplus.com/reference/cstdlib/atof/?kw=atof
Something like this
Please note that the code might have some errors(probably typing since it was writen directly in the browser on this page)
1 2 3 4 5 6 7 8 9 10 11 12 13 14
ifstream fIn("file.in");
if(fIn.is_open())
{
while(fIn.good())
{
string line;
getline(fIn, line);
string firstFloat = line.substr(0, (line.find_first_of(",") - 1)); // this assignts to firstFloat the value of the first number by copying from the beginning to the position of the coma - 1 because you don't want to include the coma as well
string secondFloat = line.substr((line.find_last_of(",") + 1), string::npos); // the second float number
float f1 = atof(firstFloat.c_str());
float f2 = atof(secondFloat.c_str());
.....
and the rest of your code doing what you want with the 3 values.
also note that i didn't extract the city name but you can do it the same way using substr and the position of the 2 commas.
the one he deleted so somebody could not see it. same with his thread he started called "Good stuff" and all it says is good stuff so I wouldn't even bother helping him