boolean function

have 3 threshold values: 90, 80, 70; need to derive a function that returns a grade; the function takes 3 inputs: a, b, c corresponding to 3 threshold values and g the grade; the function should do the following: checks inputs are valid, if not valid returns N, if valid returns grade. Not sure this makes sense:

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

//Function definitions
float 
isValid(int a, int b, int c, int g)
{
	if (100 > a && a > b && b > c && c > 0)

		float Grade;

	        if (a >= 90) {

		    Grade = A;
}

    	        else if (a >= 80 && a <= 89) {

		     Grade = B;
}

	        else if (a >= 70 && a <= 79) {

		     Grade = C;
}

	        else if (a <= 69) {

		     Grade = F;
}
                return 1;

       
        else {

	   Grade = 0.0;
}
        return N;

}


Topic archived. No new replies allowed.