mercredi 11 mars 2015

Using ifstream in QT Creator, C++


So I'm doing Stanford's CS106B course on C++ and I'm attempting to use the qt creator IDE that they recommend for homework assignments. I'm attempting to simply open a text file called "grades.txt" using ifstream. Which should be simple enough but for some reason it seems that my program cannot find the file. Please take a look.


Here's a link to the image of my workflow, including code. The implementation of getMax(), getMin() and getAverage() shouldn't matter.


http://ift.tt/1xeemLv


The error produced by QT is Error: Vector::operator []: index of 0 is outside of valid range (empty vector). The other error message is one that I produced myself to see if the file failed to open.


Also, if you want to downvote a question, it'd be good to know the reasons why.




Aucun commentaire:

Enregistrer un commentaire