0

I'm working on this program where I am supposed to use classes to store information like name, education and phonenumber for students and I'm almost there.

When im trying to set a string to the variable utbildning the whole thing starts printing out "Education" in what seems like an eternity.

Is there some problems between getline and objects im missing?

This is inside a switchcase in my main.

case 5:
 std::cout << "Education: ";
 getline(std::cin, utbildning);
 stud1.setEducation(utbildning);
break;

And this is inside my .h file:

void setEducation(std::string education);
std::string Student::getEducation();

And this inside my definition.c file:

void Student::setEducation(std::string education)
{
    this->education = education;
}
std::string Student::getEducation()
{
   return this->education;
}

If needed I could post the whole code, but I'd figure that be alot of unnecessary info.

Thanks in advance.

niyz
  • 9
  • 5

0 Answers0