Trying to define a function that dynamically creates a Student object and then prompts the user for the info and returns pointer to a Student object.
class Student{
private:
string firstName;
string lastName;
string aNumber;
double GPA;
public:
Student ();
Student (string f, string l, string idNo, double gPoint);
string getfirstName () const;
void setfirstName (string f);
string getlastName () const;
void setlastName (string l);
string getaNumber () const;
void setaNumber (string idNo);
double getGPA ()const;
void setGPA (double gPoint);
};
#endif
.cpp
void setupStudent(){
Student *studPtr1;
studPtr1 = new Student;
cout<<"Enter first name ";
cin>>f;
studPtr1->getfirstName();
cout<<"Enter last name ";
cin>>l;
studPtr1->getlastName();
cout<<"Enter A number";
cin>>idNo;
studPtr1->getaNumber();
cout<<endl;
studPtr1->setGPA(double gPoint);{
gPoint=0;}
return studPtr1;