I've been trying to use the stoi() function but it throws some weird error on DevC++5.11. Some of my friends are able to run it(On different IDE's or Text Editors), but i can't for some reason.
I've tried a lot of things (Compiler Options, Programs in Compiler Options, etc), but none of them have worked.
The code i'm trying to run is the next one:
out_file.open("calificaciones_disp.txt", ofstream::app); // Agrega lÃneas al archivo
if (cuenta > 0) {
int suma = 0;
for (int i=0; i<cuenta; i++) {
out_file << "Alumno: " << calificaciones[i][0] << " calificacion: " << calificaciones[i][1] << endl;
suma += stoi(calificaciones[i][1]);
}
out_file << "Promedio: " << (double)suma/cuenta << endl;
} else {
out_file << "El archivo no tenia datos" << endl;
}
out_file.close();
This is what it shows in console:
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
So my question is, what can i do? or is there some IDE better than DevC++ that you'd recommend me? if so, any links?
Thank you in advance ;)
P.D.