#include <stdio.h>
enum day_type { //sun, mon, tue, wed, thu, fri, sat, smart, DAY_END };
char caDay[DAY_END][10] = {//"sunday", "monday", "tuesday", "wednesday", "thurday", "friday", "saturday", "smartday"};
int main() { int iCnt; int iDay; char buff[11];
for(iCnt=0;iCnt<DAY_END ;++iCnt) { printf("%s\n", caDay[iCnt]);
} printf("숫자를 넣으세요 : "); scanf("%d", &iDay); iDay= iDay%DAY_END; printf("%s\n", caDay[iDay]); printf("찾고자 하는 요일 입력 : "); iDay = read(0, buff, 10); --iDay; buff[iDay]= 0; for(iCnt=0;iCnt<iDay;++iCnt) { buff[iCnt]=tolower(buff[iCnt]);
} for(iCnt=0;iCnt<DAY_END;++iCnt) { if(0==strncmp(buff, caDay[iCnt], iDay)) { printf("%s\n", caDay[iCnt]); //break; }
}
/*if(iCnt==DAY_END) { printf("찾는 문자열 없음\n"); }*/
return 0; }
|