// An example of grading (and conditional expressions in C

#include <stdio.h>

#define A_LIMIT 90
#define B_LIMIT 75
#define C_LIMIT 60

#define A_GRADE 4
#define B_GRADE 3
#define C_GRADE 2
#define F_GRADE 1

int main(int argc, char* argv[]) {
    int points;
	int grade;
	printf("Enter your number of points: ");
    scanf("%d", &points);
	if (points > A_LIMIT) {
		grade = A_GRADE;
	} else {
		if (points > B_LIMIT) {
			grade = B_GRADE;
		} else { 
			if (points > C_LIMIT) {
			   grade = C_GRADE;
			} else {
				grade = F_GRADE;
			}
		}
	}
    // now, evaluate the grade
	switch(grade) {
		case A_GRADE:
			printf("Excellent!\n");
			break;
		case B_GRADE:
			printf("OK, but keep on working...\n");
			break;
		case C_GRADE:
			printf("Needs improvement!\n");
			break;
		case F_GRADE:
			printf("You should work harder next time.\n");
			break;
        default:
			printf("There must be an error somewhere!\n");

	}
}


