#include #include "checkit.h" #include void printComment(char grade); void getNewCoords(char key, int x, int y); int main() { int x,y; x = 5; y = 3; getNewCoords('Q',x,y); printf("=== (%d,%d) ===\n",x,y); return 0; } void getNewCoords(char key, int x, int y) { printf("(%d,%d)-->",x,y); switch (key) { case 'q': case 'Q': { x=x-1; y=y+1; break;} case 'w': case 'W': { y=y+1; break;} case 'e': case 'E': { x=x+1; y=y+1; break;} case 'a': case 'A': { x = x-1; break;} case 's': case 'S': { y=y-1; break;} case 'd': case 'D': { x=x+1; break;} case 'z': case 'Z': { x= x-1; y=y-1; break;} case 'c': case 'C': { x=x+1; y=y-1; break;} default : {printf("Not a command\n");break;} } printf("(%d,%d)\n",x,y); return; } void printComment(char grade) { printf("%c :",grade); switch (grade) { case 'A': {printf("Excellent!\n");break;} case 'B': {printf("Good!\n");break;} case 'C': {printf("You passed!\n");break;} case 'D': {printf("Not quite...\n");break;} case 'F': {printf("Ouch...\n");break;} default : {printf("Not a grade\n");break;} } return; }