我试图用c编译一个程序,但我一直得到同样的两个错误。我得到的错误是:
error: expected ‘)’ before ‘idSubject’
printf("%d" idSubject);
和另一个:
format ‘%d’ expects a matching ‘int’ argument [-Wformat=]
以下是代码:
#include <stdio.h>
#include <stdlib.h>
void averageMark (idSubjectE) {
typedef enum {FALSE,TRUE} bool;
int i;
float acum;
int idChair;
int idSubject;
int numEst;
float mark;
bool found=FALSE;
scanf("%d", &idChair);
printf ("%d", idChair);
scanf("%d", &idSubject);
while (idSubject!=0) {
scanf("%d", &numEst);
if (idSubject==idSubjectE) {
printf("%d" idSubject);
found=TRUE;
for (i=1; i<numEst*2; i++) {
if (i%2==0){
scanf("%f", &mark);
acum=acum+mark;
}
}
printf("%f", acum/(float)numEst);
}
scanf("%d", &idSubject);
}
}
int main(){
averageMark(12);
}
我一直在努力尝试,但我无法找到错误,
答案 0 :(得分:5)
将printf("%d" idSubject);
更改为printf("%d", idSubject);
,注意,