โ๏ธ C Programming/๋๊ตฌ๋ ์ฝ๊ฒ ์ฆ๊ธฐ๋ C ์ธ์ด ์ฝ์ํธ_๊ฐ์ 3ํ31 [๋๊ตฌ๋ ์ฝ๊ฒ ์ฆ๊ธฐ๋ C ์ธ์ด ์ฝ์ํธ - ๊ฐ์ 3ํ] 12์ฅ Mini Project ๋ฌธ์ ํ์ด # 12์ฅ Mini Project ๋ฌธ์ ํ์ด 485p_Mini Project) #include #include #include int main() { FILE* fp; fopen_s(&fp, "plain.txt", "w"); if (fp == NULL) { printf("ํ์ผ์ ์ด ์ ์์ต๋๋ค.\n"); exit(0); } int encrypt_key = 0; char plain_text[30]; printf("ํ๋ฌธ์ ์ ๋ ฅํ์์ค: "); gets_s(plain_text, 30); fputs(plain_text, fp); printf("์ํธํ ํค: "); scanf_s("%d", &encrypt_key); int leng = strlen(plain_text); int i = 0; printf("\n"); .. 2023. 1. 28. [๋๊ตฌ๋ ์ฝ๊ฒ ์ฆ๊ธฐ๋ C ์ธ์ด ์ฝ์ํธ - ๊ฐ์ 3ํ] 11์ฅ Programming ํ์ด # 11์ฅ Programming ํ์ด 455p_1๋ฒ) #include int main() { int i = 0; char yes_or_no; union student { char number[50]; char student_number[50]; char name[50]; char phone[50]; }; union student user[100]; printf("ํ์์ด์ญ๋๊น?: "); scanf_s("%c", &yes_or_no); if (yes_or_no == 'y') //ํ์์ผ ๊ฒฝ์ฐ { printf("์ฑํจ์ ์ ๋ ฅํด ์ฃผ์ธ์: "); rewind(stdin); gets_s(user[i].name, 50); printf("ํ๋ฒ์ ์ ๋ ฅํด ์ฃผ์ธ์: "); rewind(stdin); gets_s(user[i]... 2023. 1. 27. [๋๊ตฌ๋ ์ฝ๊ฒ ์ฆ๊ธฐ๋ C ์ธ์ด ์ฝ์ํธ - ๊ฐ์ 3ํ] 11์ฅ Mini Project ๋ฌธ์ ํ์ด # 11์ฅ Mini Project ๋ฌธ์ ํ์ด 451p_Mini Project) #include #include struct Lib { int number; char writer[100]; char title[100]; }; int main() { int num = 0; int how_many_books = 2; char writer_search[100]; char title_search[100]; struct Lib book[200]; book[0].number = 1; strcpy_s(book[0].writer, 20, "Mina"); strcpy_s(book[0].title, 20, "Life of lion"); book[1].number = 2; strcpy_s(book[1].writer, 20, .. 2023. 1. 26. [๋๊ตฌ๋ ์ฝ๊ฒ ์ฆ๊ธฐ๋ C ์ธ์ด ์ฝ์ํธ - ๊ฐ์ 3ํ] 10์ฅ Programming ํ์ด (2) # 10์ฅ Programming ํ์ด (2) 414p_7๋ฒ) #include #include void trim_right(char s[]) { for (int i = (strlen(s) - 1); i >= 0; i--) { if (s[i] == ' ') { s[i] = '?'; } } printf("๊ณต๋ฐฑ ๋ฌธ์๋ฅผ ์ ๊ฑฐํ ํ ์คํธ: "); for (int i = 0; i < strlen(s); i++) { if (s[i] != '?') { printf("%c", s[i]); } } } int main() { char array[20] = { "She loves it." }; trim_right(array); return 0; } 415p_8๋ฒ) #include #include void trim_left(cha.. 2023. 1. 25. [๋๊ตฌ๋ ์ฝ๊ฒ ์ฆ๊ธฐ๋ C ์ธ์ด ์ฝ์ํธ - ๊ฐ์ 3ํ] 10์ฅ Programming ํ์ด (1) # 10์ฅ Programming ํ์ด (1) 413p_1๋ฒ) #include #include int main() { char string_array[10]; char cnt_array[26] = { 0 }; printf("ํ ์คํธ๋ฅผ ์ ๋ ฅํ์์ค: "); gets_s(string_array, 10); for (int k = 'a', i = 0; i < strlen(string_array) / sizeof(char); k++, i++) { cnt_array[string_array[i] - 97]++; } for (int p = 'a', i = 0; i < 26; p++, i++) { if (cnt_array[i] != 0) { printf("%c๋ฌธ์๊ฐ %d๋ฒ ๋ฑ์ฅํ์์ต๋๋ค.\n", p, cnt_array[i]).. 2023. 1. 24. [๋๊ตฌ๋ ์ฝ๊ฒ ์ฆ๊ธฐ๋ C ์ธ์ด ์ฝ์ํธ - ๊ฐ์ 3ํ] 10์ฅ Mini Project ๋ฌธ์ ํ์ด # 10์ฅ Mini Project ๋ฌธ์ ํ์ด 409p_Mini Project) #include #include #include int main() { char plain_text[30] = ""; int encrypt_key = 0; printf("ํ๋ฌธ: "); gets_s(plain_text, 30); printf("\n์ํธํ ํค: "); scanf_s("%d", &encrypt_key); int leng = strlen(plain_text); int i = 0; while (1) { if (plain_text[i] == '\0') { if (i > leng) { break; } else { plain_text[i] == '\0'; } } else { if (plain_text[i] >= 'A' && .. 2023. 1. 23. ์ด์ 1 2 3 4 5 6 ๋ค์