I am trying to write a very simple application that allows me to enter a number which will allocate a particular grade.
I've not used the C language very much as i primarily use C# however i still don't seem to be able to get around the errors:
They are all syntax errors, ranging from "if" to "{" although i'm sure everything is as it should be.
One i don't understand is the "void illegal with all types" at the grade = assess(mark);
section.
I understand the program may not product the correct output but im simply trying to get it to compile.
Thank you for your help, i imagine I'm doing something REALLY obvious.
Task.c
#include <stdio.h>
#include <string.h>
//Protoype
void assess(int* mrk);
// Main method (start point of program)
void main()
{
int mark;
char grade;
printf("enter a word: ");
scanf("%d", &mark);
grade = assess(mark);
printf("That equals ");
printf("%c", grade);
printf(" when marked\n");
}
char assess(int* mrk)
{
char result;
if(mrk > 0 && <= 100)
{
if(mrk < 35)
{
result = "f";
}
if(mrk >= 35 && <= 39)
{
result = "e";
}
if(mrk >= 40 && <= 49)
{
result = "d";
}
if(mrk >= 50 && <= 59)
{
result = "c";
}
if(mrk >= 60 && <= 69)
{
result = "b";
}
if(mrk > 70)
{
result = "a";
}
}
else
{
result = "error";
}
return result;
}