For a piece of code I'm writing for a class, I keep getting an infinite loop with the console output of the program during execution as soon as I enter the sentinel value to end the input process. Any pointers on what I did wrong would be appreciated.
Here's the code in question:
#include<iomanip>
#include<iostream>
#include<string>
using namespace std;
struct Student {
string name;
int id;
float gpa;
Student* next;
};
int main() {
Student* head = 0;
string rRequest = "Yes";
int count = 0;
while(rRequest != "No") {
Student* aStudent = new Student;
cout << "Do you want to enter a student record?[Yes/No]: ";
getline(cin, rRequest);
We all do it. If you stare at a problem too long you can get code blindness. You start seeing what you think you wrote rather than what you actually did write. ;o)