Hello everyone,
I am having a problem, and I pray some better programmers out there in internet land can help me with it. I am writing this project that uses multi-dimensional arrays and deals with file I/O to tab-delimited text files.
Up until now it was working FINE. It builds with no errors, compiles with no errors. And it was running perfectly fine. Now, all of a sudden, run it and I get a whole mess of errors.
It gets up to this point in my main function:
Code:
#include "datahandler.h"
#include "gradebook.h"
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdlib>
#include<cctype>
#include<string>
#include<vector>
#include<sstream>
using namespace std;
//FUNCTION PROTOTYPES
void displayMenu();
int main(){
//create a local data-handler object to get a few preliminary
//necessaries out of the way
DataHandler dh;
std::string classID;
//create a 2D vector to hold all the class names so we can
//deal with them individually:
std::vector<std::vector<std::string>> vecClassNames;
//fill the vector with all the information from Classes.txt
dh.fillVector("Classes.txt", vecClassNames);
//I've made this a const int since we won't be providing the user
//the option to add any more classes than those that already exist in Classes.txt
const int classCount = vecClassNames.size();
//now we can create a vector of GradeBooks for each class:
std::vector<GradeBook> gradeBooks (classCount);
for(unsigned int i=0; i<gradeBooks.size(); i++){
//since we KNOW that [i][0] holds the class ID, and [i][1] holds the Class Name
//we can pass those valuse in order to the GradeBook constructor
gradeBooks[i] = GradeBook(vecClassNames[i][0], vecClassNames[i][1]);
}
Okay, fine up to there, then I walked on in to the GradeBook contructor:
Code:
GradeBook::GradeBook(std::string ID, std::string ClassName){
//fill a vector with Student Informaiton for this particular gradebook
std::string filename = "StudentInfo.txt";
className = ClassName;
classID = ID;
//fill the vecStudents vector
dh.fillVector(ID, filename, vecStudents);
//fill a vector with assignment information for this particular gradebook
filename = "Assignments.txt";
dh.fillVector(ID, filename, vecClassAssignments);
//fill a vector with student grade information for this particular gradebook
filename = "StudentGrades.txt";
dh.fillVector(filename, vecStudents, vecStudentGrades);
}
so, once it hits that point, it starts going haywire.
I get:
1. Unhandled exception at 0x77b715de (ntdll.dll) in StudentGradeBook.exe: Microsoft C++ exception: std:

ut_of_range at memory location 0x0041f380..
with the options only to Break or Continue
If I click Continue I get:
2.Unhandled exception at 0x77b715de (ntdll.dll) in StudentGradeBook.exe: 0x00000000: The operation completed successfully.
...with the same options pretty much repeatedly.
I have absolutely no idea how to solve this problem. ANY help at all would ... well, it would help.
Also, this isn't a class assignment or anything, I'm just ... well, I was TRYING to help a friend who's taking a C++ class, and I thought I was doing pretty well up to this point, but I just can't fathom why all of a sudden it would stop working. I can code alright, but I don't understand all of the cryptic crap in these header files where all of these errors are occurring.