Ok, this is another question I hate to even post but here goes.
The program never waits for an input for cin >> newstudent .
I have determined that the "while(cin >> x)" is the problem by commenting this part out, but I don't understand why.
Thanks in advance.
Code:#include<iostream> #include<string> #include<cstdlib> #include<fstream> #include<vector> using namespace std; struct Student_info { string name; double midterm, final; vector<double> homework; }; int main() { Student_info record; string newstudent = "y"; while (newstudent == "y") { cout << "Name: "; cin >> record.name; cout << "\tMidterm: "; cin >> record.midterm; cout << "\tFinal: "; cin >> record.final; cout << endl << "Please enter homework grades followed by end-of-file."; cout << endl; vector<double> homework; int x; while(cin >> x) record.homework.push_back(x); ofstream outfile("Student_records.txt"); outfile << record.name << " "; outfile << record.midterm << " "; outfile << record.final << " "; for(int i = 0; i != record.homework.size(); ++i) outfile << record.homework[i] << " "; outfile.close(); cout << "Student has been entered into record." << endl; cout << "Enter another student? (y/n) " << endl; cin >> newstudent; } system("pause"); return 0; }