expected primary-expression before

Hello All!

I am new to this forum, and I am looking for a little bit of help. I have the following code that is continuously getting the same errors. I am sure this is something simple that I am just over looking, probably due to staring at this for so long. Any help would be greatly appreciated!

Thank you in advance!

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
41
42
43
44
45
46
47
48
#include <iostream>
#include <fstream>
#include <string>

using namespace :: std;


#define sNUMBER 50

void tPrint(string*student);
void sPrint(string*student);
void alpha(string*student);
int generate();
//Function Definitions
void tPrint(*student pArray,alpha){
	if(alpha != 1){
		alpha(pArray);
	}
	int i;
	for(i=0; i<sNUMBER;i++){
		pArray->tPrint();
		pArray+=1;
	}
}
void sPrint(*student pArray,alpha){
	if(alpha != 0){
		alpha(pArray);
	}
	int i;
	for(i=0; i<sNUMBER;i++){
		pArray->sPrint();
		pArray+=1;
	}
}
void alpha(*student pArray){ 
	int i;//counter
	int j;//counter
	for(i=0;i<sNUMBER-1;i++){
		for(j=0;j<sNUMBER-1-i;j++){
			//combine first and last names into full names
			if(strcmp((pArray->GetsName().GetfName())+=" " +=(pArray->GetsName().GetlName()),((pArray+1)->GetsName().GetfName())+=" "+=((pArray+1)->GetsName().GetlName()))>0){
				swap(pArray[j],pArray[j+1])
			}
		}
	}
}



I am getting the following errors:

C:\Users\main.cpp|15|error: variable or field ‘tPrint’ declared void|
C:\Users\main.cpp|15|error: expected primary-expression before ‘pArray’|
||=== Build finished: 2 errors, 0 warnings ===|

Last edited on
The "alpha" variable is set to 'void' in Line 15 and Line 25 because you did not give it a data type.

That '*' character should be on the other side of student for all of these.
You've got the prototype right, but the function definition wrong. They should look like:
 
void tPrint(string*student pArray){
Thank you! Now I have a whole new list of errors, but at least this got me started!
Last edited on
8-0 Wow I messed up on that one!
Topic archived. No new replies allowed.