I wrote a class called Student that should asked the user lastname, firstname, credits, gpa, date of birth, date of matriculation. I wrote accessors(get functions) and mutators (set functions) for each of private variables. I construct
two constructors for one is default and other to initialize the variables. I also made input and output functions to get information from keyboard and to print it.
I made a standing function based on credits.
Problem 1:Now my problem is when I use getline to get input from keyboard it is not asking me the date of birth.
Problem 2: When I initialize a constructor with some data and use the same object to use in input function it is printing both constructor and keyboard input.
For now I am just giving the input function ,if you need my full code I would
love to give you.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
void Student:: input()
{
cout << "Please give me your lastname:";
getline(cin,lastname);
cout << "Please give me your firstname:";
getline(cin,lastname);
cout << "Enter number of credits you earned:";
cin >> credits;
cout << "What is your GPA:";
cin >> gpa;
cout << "Enter you date of birth:";
getline(cin,date_of_birth);
cout << "Enter you matriculation date:";
getline(cin,date_of_matriculation);
}
|
Please help me.