You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
drd/学籍管理系统1.cpp

31 lines
986 B

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int main() {
char choice[10];
printf(" 1.Input\n");
printf(" 2.Output\n");
printf(" 3.Order\n");
printf(" 4.Quit\n");
scanf("%s", choice);
// 将输入的字符转换为小写字母,方便后续判断
for (int i = 0; i < strlen(choice); i++) {
choice[i] = tolower(choice[i]);
}
if (strcmp(choice, "i") == 0) {
printf("You are trying to Input info\n");
} else if (strcmp(choice, "o") == 0) {
printf("You are trying to Output info\n");
} else if (strcmp(choice, "m") == 0) {
printf("You are trying to Make things ordered\n");
} else if (strcmp(choice, "q") == 0) {
printf("You are about to Quit\n");
} else {
printf("Wrong input\n");
}
return 0;
}