When I run my program in Xcode it shows the build was successful, but in the console it cycles infinitely and it shows infinite rows of only three 0's ("0 0 0"). When I took the last variable of type double it showed the same problem but instead of rows of three 0's it was rows of two 0's. My guess is that it has something to do with the variables of type double. I tried the exact same code (copy-paste) in an online compiler (repl.it) and it did work accordingly.
I tried to put different numbers in the .txt file and also changed the names of the variables
#include <iostream>
#include <fstream>
using namespace std;
int main() {
string sID, sDesc, sUMed, sFam, sClass, sTitulo, sClave;
double dPrecio1, dVolumen, dLongitud; //dPrecioFinal;//dPrehilecio2, dPrecio3 ... dPrecioN
ifstream inputFile;
inputFile.open("ListaDePrecios.txt");
while(inputFile >> sID >> sDesc >> sUMed >> sFam >> sClass >> dVolumen >> dLongitud >> dPrecio1){
cout << sID << " " << sDesc << " " << sUMed << " " << sFam << " " << sClass << " " << dVolumen << " " << dLongitud << " " << dPrecio1 << endl;
}
return 0;
}
File "ListaDePrecios.txt" contains:
CRE-AP65 Descripcion ML CUB-IMP COMP 1.0 2.0 16484.70
CRE-AP75 Descripcion ML CUB-IMP COMP 1.0 2.0 15705.26
CRE-AP65SR Descripcion ML CUB-IMP COMP 1.0 2.0 16333.47
CRE-AP75SR Descripcion ML CUB-IMP COMP 1.0 2.0 12564.20