Commit fbd65371 authored by Jared Sexton's avatar Jared Sexton

Updating save practices for students in main

parent baa2da88
......@@ -23,6 +23,7 @@ int main() {
cin >> currentUser;
if (cin) {
if(currentUser == teacher.getExitCode()) {
keepRunning = false;
}
else if (currentUser == teacher.getUserName()) {
......@@ -35,14 +36,17 @@ int main() {
}
else if (teacher.checkRoster(currentUser) >= 0) {
int currentUserIndex = teacher.checkRoster(currentUser);
// Make new student object and copy all their info from teacher vector
Student currentStudent;
currentStudent = teacher.getStudent(currentUserIndex);
// Current user (Student object) : currentStudent
// Current user (Student object) is currentStudent
// save any changes back into teacher vector
teacher.setStudent(currentStudent);
// save any changes to the file.
teacher.saveProgress();
}
else {
cin.clear();
......
......@@ -40,8 +40,6 @@ class Teacher {
void setUserName(string userNameIn);
void setStudent(Student studentIn); // I think it's safe to say that studentIn will be a student in the vector; so the function will find where the student goes in the vector by itself
// vector<Student> roster;
private:
bool teacherMenuActive = 1;
string userName;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment