mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-12-16 15:44:39 +00:00
12 lines
266 B
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;
|
|
}
|