#include "stdafx.h"
#include
int _tmain(int argc, _TCHAR* argv[])
{
int key = getch();
if(key == '1')
printf("excellent\n");
else if(key == '2')
printf("good\n");
else if(key == '3')
printf("pass\n");
else if(key == '4')
printf("fail\n");
else
printf("error\n");
return 0;
}
其实用switch更好
getch()返回的数字键和ascii码是一致的