I am trying to write a function that will compute GPA.

#include "Student.h"
#include "ClassInformation.h"

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;
}

ClassInformation* setupClassInformationArrary(int *length){
	int *maxClasses;

	ClassInformation *classInfo;
	classInfo = new ClassInformation[*maxClasses];
	return classInfo; 
};


void readClassInformation(ClassInformation*singleGlass){
	string cName;
	int cNumber,h;
	char g;

	cout<<"Enter class name ";
	cin>>cName;
	singleGlass->setclassName(cName);//change these lines
	cout<<"Enter class number";
	cin>>cNumber;
	singleGlass->setclassNumber(cNumber);
	cout<<" Enter credit hours ";
	cin>>h;
	singleGlass->setcreditHrs(h);
	cout<<"Enter student's letter grade";
	cin>>g;
	singleGlass->setletterGrade(g);
}; 

void computeGPA (Student *studPtr1,ClassInformation *singleGlass[],int numClasses){
	int gpa=0;

	for (int i=1;i<numClasses;i++){
		"studPtr1.singleGlass[i].getletterGrade()"; *
		"singleGlass[i].getcreditHrs()"/
		gpa= gpa+ "singleGlass[i].getcreditHrs()";
	}
	// (grade * credithour) + (grade * credithour) / credithour+credithour = gpa
};

When I debug I have a warning of "+" operator has no effect, expected operator with side-effect.
Any help would be greatly appreciated. Thank you in advance.

Could you please post the code of Student.h also.
As per my understanding of this code you are trying to add int and string

gpa= gpa/*int*/+ "singleGlass[i].getcreditHrs()"/*string*/

.

Just wants to check what will Student::getcreditHrs returns.

When will noobies stop posting questions without the information they have that can easily answer their question?

When posting errors, don't post a part of the error -- copy and paste the ENTIRE error, verbatim, including line number, listed code, EVERYTHING.

sorry about that... here is the code for my .h files
student.h

#ifndef STUDENT_H
#define STUDENT_H
#include <iostream>
#include <string>
using namespace std;

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

and classinformation.h

class ClassInformation{
private:
	int classNumber;
	string className;
	int creditHrs;
	char letterGrade;
	int pointGrade;

public:
	ClassInformation ();
	ClassInformation(int cNumber,string cName,int h, char g,int pg);

	int getclassNumber() const;
	void setclassNumber(int cNumber);
	string getclassName() const;
	void setclassName(string cName);
	int getcreditHrs() const;
	void setcreditHrs(int h);
	char getletterGrade () const;
	void setletterGrade (char g);
	int getpointGrade () const;
	void setpointGrade (int pg);
	
};

#endif

The error is " 7 IntelliSense: expression must be a modifiable lvalue c:\users\honeybunny\documents\visual studio 2010\projects\assignment5\assignment5\pass5.cpp 64
and Warning 1 warning C4552: '+' : operator has no effect; expected operator with side-effect c:\users\honeybunny\documents\visual studio 2010\projects\assignment5\assignment5\pass5.cpp 67"

"studPtr1.singleGlass[i].getletterGrade()"; *
"singleGlass[i].getcreditHrs()"/
gpa= gpa+ "singleGlass[i].getcreditHrs()";

These are definitely your problem lines. Why have you made them strings? Also, what is the / for?

To execute a method, you don't wrap it in speech marks, that indicates a string value (not a return string value, but that what you've written right there is a string value).

I am trying to do here is have my for loop go through the array for a single student and calculate GPA: (grade * credithour) + (grade * credithour) / (divide) credithour+credithour = gpa

For example, suppose a student had these grades:
A in 3 hour course
B in 3 hour course
A in 2 hour course
The GPA for this student would be:
((A * 3) + (B * 3) + (A * 2) )/ (3 + 3 + 2) =
((4 * 3) + (3 * 3) + (4 * 2) )/ (3 + 3 + 2) =
(12 + 9 + 8)/ (3 + 3 + 2) = 29/8 = 3.625 GPA

Hope this makes more sense.

I am trying to do here is have my for loop go through the array for a single student and calculate GPA: (grade * credithour) + (grade * credithour) / (divide) credithour+credithour = gpa

For example, suppose a student had these grades:
A in 3 hour course
B in 3 hour course
A in 2 hour course
The GPA for this student would be:
((A * 3) + (B * 3) + (A * 2) )/ (3 + 3 + 2) =
((4 * 3) + (3 * 3) + (4 * 2) )/ (3 + 3 + 2) =
(12 + 9 + 8)/ (3 + 3 + 2) = 29/8 = 3.625 GPA

Hope this makes more sense.

They still shouldn't be strings, take away the quotation marks. If you need to perform some calculations first, use parenthesis, just like in your formula.

OVERDUE UPDATE:

Realized that I needed to declare my variables and set to each part of my calculation along with your correction Ketsuekiame. Thank you.

This question has already been answered. Start a new discussion instead.