Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
-
The problem statement, all variables and given/known data:
i know when undefined reference shows up the program is saying it is not link to that function but the problem says that it is in driver.c -
Relevant commands, code, scripts, algorithms:
makefile (GIVEN)
# target to make all programs for Lab 9
all: mygrader mygrader2 countgrades
# Problem 1 - grader programs
#complete the dependency and action lines for your filenames
mygrader: driver.o mygrader.o
cc driver.o mygrader.o -o mygrader.
driver.0:mygrader.h
mygrader.o:mygrader.h
mygrader2:
cc -o mygrader2
# Problem 2 - grade counter
countgrades: countgrades.o
cc -o countgrades countgrades.o
# source file dependencies
# add target lines showing dependencies for your .o files
# utility targets
clean:
rm -f *.o
real_clean: clean
rm -f mygrader mygrader1 countgrades
mygrader.h
char assign_grade(int score);
/* Given: a score
Return: a letter grade
*/
mygrader.c
#include "mygrader.h"
char assign_grade(int score)
{
if(score>=90 && score<=100)
{
return 'A';}
if(score>=80 && score<=89)
{
return 'B';}
if(score>=70 && score<=79)
{
return 'C';}
if(score>=60 && score<=69)
{
return 'D';}
if(score>=0 && score<=59)
{
return 'F';}
if(score<0 || score>100)
{
return ' ';}
}
and driver.c
#include <stdio.h>
#include "mygrader.h"
int main()
{
int s;
char grade;
while(scanf("%d", &s) == 1)
{
printf("%d: ", s);
grade = assign_grade(s);
if(grade == ' ')
{
printf("illegal score\n");}
else
{
printf("%c\n", grade);}
}
}
3
. The attempts at a solution (include all code and scripts):
The attempts are above its just the link problem i need solve
- Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course): University of Hawaii at Manoa, Honolulu (HI), Oahu (Hawaii) , Tep Dobry, ee160(EE 160: Lab 9)
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
---------- Post updated at 10:51 PM ---------- Previous update was at 10:30 PM ----------
Sorry forgot to add the problem but the undefined reference is referring to assign_grade