목록전체 글 (402)
Creative Code
※main.c파일 #include #include "string.h" int main(void) { char title1[] = "wonderful tonight"; int len = my_strlen(title1); // 문자열의 길이 printf("len : %d\n", len); //메모리에 할당된 공간은 18바이트지만 문자열의 길이는 17바이트로 출력 char title2[my_strlen(title1)+1]; my_strcpy(title2,title1); //문자열 복사 if (my_strcmp(title1,title2) == 0 ) { // 문자열 비교 결과가 0이면 같음 printf("title1 and title2 are equal\n"); } else { printf("title1 and..
#include typedef struct student { char name[21]; int kor; int eng; int mat; int total; double average; int rank; }Student; int main(void) { FILE *fin, *fout; fin = fopen("score.dat","r"); // 읽기용 fout = fopen("score.out","w"); //쓰기용 Student students[10]; int board[10]; for (int i = 0; iaverage,table[i]->rank); } fclose(fin); fclose(fout); return 0; }
ParkJungSeok 100 100 100 LimYoHan 95 80 95 LeeYoungHo 90 95 83 MaJaeYoon 59 55 50 LeeJaeDong 90 80 95 LeeYoonYeol 85 73 65 ChoYounSung 55 50 45 LeeGisuk 90 95 83 KangMin 95 83 75 HongJinHo 85 85 84
#include int main(void) { //char name[21]; char buf[21]; char *name = buf; scanf("%20s",name); printf("%s\n",name); return 0; }
#include int main(void) { char name[21]; scanf("%20s",name); // scanf는 띄어쓰기를 구분할 수 없다. (받는 글자 수를 최대 20글자로 제한) printf("%s\n",name); return 0; }