Hi, really new to C programming and I need help writing this program that a user inputs three test scores and then is added and then the average is calculated. The problem is I keep getting these errors and I have no idea what the problem is.
The errors are posted as follows:
XTCREDIT.c:13:error:expected identifier or a^(a^ before a^chara^)
XTCREDIT.c:16:error:a^DRAWLINESa^ (first use in this function)
XTCREDIT.c:16:errorEach undeclared identifier is reported only once for each function it appears in.)
XTCREDIT.c:21:a^combinedNamea^ undeclared (first use in this function)
Here is my code:
Code:
#include<stdio.h>
#include<string.h>
#define addr(var) &var
#define REPORTHEADINGS1 " STUDENT T1 T2 T3 AVG \n"//Heading of the program
#define REPORTHEADINGS2 " ======= == == == ===\n"//Heading of the program
#define REPORTFORMAT " %-10s%3d%7d%7d%8.2f\n "//how much space each word is separated by another
void DrawLines(void);//function to draw lines
int main(void)
{
char ln[15+1], fn[15+1], char combinedName[30+1];
int t1,t2,t3;//these are the three test scores of the tests taken
float avg;//the avg calculated
printf(DRAWLINES);
printf("Enter the student's first name");
scanf("%s", fn);
printf("Enter the student's last name");
scanf("%s", ln);
strcpy(combinedName, ln);
strcat(combinedName, ", ");
strcpy(combinedName, fn);
print("Enter the student's three(3) test scores seperate with space ");
scanf("%d%d%d", addr(t1), addr(t2), addr(t3));
avg=(t1 +t2+t3)/3.0;
printf(DRAWLINES);
printf(REPORTHEADINGS1), printf(REPORTHEADINGS2);
printf(REPORTFORMAT, combinedName, t1,t2,t3,avg);
fflush(stdin);
printf(" Press any key to continue....\n"), getchar();
return (0);
}
void Drawlines()
{
printf("======================================");
}
Notes: ln=last name of the student, fn=first name of the studen, combinedName is the full name of the student separated by a comma.
P.S: if there is anything that i haven't explained please tell me. Thank you much appreciated.