๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

โœ’๏ธ 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.