1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-12-16 15:44:39 +00:00
202401-programming-assignments/【实践课外】14.指针2/6-5 查找星期.c

12 lines
266 B
C

const char WEEKDAYS[][10] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
int getindex(char *s) {
for (int i = 0; i < 7; i++) {
if (strcmp(s, WEEKDAYS[i]) == 0) {
return i;
}
}
return -1;
}