Question
hello, I am working on my project and I am getting an Infinite loop when entering a character what did I do wrong here? #include
hello,
I am working on my project and I am getting an Infinite loop when entering a character
what did I do wrong here?
#include
using namespace std;
class Student { public: Student(); Student(string, int, char); ~Student();
string getName() const; int getAge() const; char getGrade() const;
void setName(string); void setAge(int); void setGrade(char);
private:
string newName; int newAge; char newGrade;
}; void fillVector(vector
/**************************** * Function: main * Description: The main control. allow to enter and use as much it wants. *****************************/ int main() { vector
//again read the user choice until user presses exit button cout << endl << "1: Add\t2: View\t3:Delete 4:Exit" << endl; cout << "Enter your choice:"; cin >> pick; cout << endl; }
return 0; }
/**************************** * Function: fillVector * Description: let the function to read the values and add the vector *****************************/ void fillVector(vector
for (i = 0; i < studentInfo.size(); i++) { deleteName = studentInfo[i].getName();
if (deleteName == name) { error = 1; break; } } if (error == 0) cout << endl << "Unable to find your name in the system" << endl; else { studentInfo.erase(studentInfo.begin() + i); cout << endl << "your infomation is deleted." << endl; } } } /**************************** * Function: printVector * Description: let the function read *****************************/ void printVector(const vector
Student::Student() { newName = ""; newAge = 0; newGrade = ' ';
}
Student::Student(string name, int age, char grade) { newName = name; newAge = age; newGrade =grade; }
Student::~Student() { } string Student::getName() const { return newName; }
int Student::getAge() const { return newAge; }
char Student::getGrade() const { return newGrade; }
void Student::setName(string name) { newName = name; }
void Student::setAge(int age) { newAge = age; }
void Student::setGrade(char grade) { newGrade = grade; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started