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;
Narue commented: For using code tags +17

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;

Your function return type must match what you return. void indicates the function does not return a value. Change it to Student*

Thank you for correcting my error...
Now with that now reading

Student* setupStudent(){
	Student *studPtr1;
	studPtr1 = new Student ();

	cout<<"Enter first name ";
	cin>>f;
	studPtr1->setfirstName(f);
	cout<<"Enter last name ";
	cin>>l;
	studPtr1->setlastName(l);
	cout<<"Enter A number";
	cin>>idNo;
	studPtr1->setaNumber(idNo);
	cout<<endl;
	studPtr1->setGPA(gPoint);
	{gPoint=0;}
	
	return studPtr1;

do I still need to define my identifier? I figured that it should read in from the class Student..

Got it... needed to define within the function.

Student* setupStudent(){
	string f,l,idNo;
double gPoint=0;

	Student *studPtr1;
	studPtr1 = new Student ();

	cout<<"Enter first name ";
	cin>>f;
	studPtr1->setfirstName(f);
	cout<<"Enter last name ";
	cin>>l;
	studPtr1->setlastName(l);
	cout<<"Enter A number";
	cin>>idNo;
	studPtr1->setaNumber(idNo);
	cout<<endl;
	studPtr1->setGPA(gPoint);
	
	return studPtr1;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.