Problems reading data from a txt file C++
I'm trying to read some information from a txt file, and trying to store it in a list, the file has the following format: 1|mexico|canada|44.4 2|canada|china|11.1 Where the fileds are id, origen, destiny and weight. I have a method that it's trying to read each of them using getline, and trying to store it in a list, but when I store the data in my list and I try to show it, it shows random numbers. How can I solve it? The code it's here: https://code.sololearn.com/c4t0PLylYZPo/#cpp Line 96 I'm showing my list data, and line 125 you can find how I'm processing the data and store it into the list, but it doesn't work. Also inside the while (137) I'm trying to convert string to int and string to double, but I'm not sure if that's the correct way to do it. Please help!