"Expression must have a class type" error

Hello!
I am new to this forum. I am looking for some help. I am VERY new to C++ and am not too sure what the error I am getting means. The code I have in my class is shown below. The error is in the subject. Anyone? Anyone? Beuler?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
class Score
{
	public:
	float calculScore(double &xx, double &y, int ng)
	{
		//computation of the score. Here it is for the oscillator.
		int NombreGenes = 5;
		int NombrePromus = 10;
		int NombreReactions = 20;
		int Reactions[30];
		int nvar= y.nrows(); //declare an integer called nvar equal to the number of rows in the y array
		int rep=NombreGenes+NombrePromus;  //declare an integer called rep equal to the Number of Genes and the Number of Promoters
		float s = 0; //variable called s equal to 0
		int nstep=xx.size(); //declare an integer called nstep equal to the size of the xx array
  
		for (int i=0;i<10;i++){ //for loop running 10 times, also declaring i
			int v=rep+1; //declaring a variable 'v' equal to the Number of Genes and the Number of Promoters plus 1
		
			if (ng==1)//ng is declared in the class constructor if ng is equal to 1 then run just below
				s+= ((y[v][i]-10)*(y[v][i]-10)); //  Gives s the value of y(array)times v(array) times i(the int in the for loop minus 10 squared 
			else//if ng is not one then run this below
				s+= ((y[v][i]-1)*(y[v][i]-1));//  Gives s the value of y(array)times v(array) times i(the int in the for loop minus 1 squared     
		}//end the for loop  
      
		int n=0;//variable called n equal to 0
		for (int i=0;i<NombreReactions;i++){  //for loop running how ever many times there are reactions , also declaring i
			if (Reactions[i].Constante!=0) //counter for the reactions
			  n++;//increment N
		}

		s*=exp(n*log(1.0001))/100.0;//multiplication factor. Basically, one multiplies by 1+0.0001*(#of reactions). It is essentially to discriminate between  cells with exactly the same dynamics for the interesting variables but with different number of reactions 


		if(s<=1e10)
		{
			return s;
		}
		else return 1e10; // filter big scores
	}
};
Line 27: Reactions is an array of ints, but you're using element i as though it was an object with a member named 'Constante'.

Next time also mention which line is causing the error.
Topic archived. No new replies allowed.