Download presentation
Presentation is loading. Please wait.
1
컴퓨터 프로그래밍 기초 - 13th : 마지막 수업 -
김선균
2
< 목 차 >
3
11번 #include<stdio.h> #include<ctype.h>
int count_word(const char *s); int main(void) { printf("%d\n", count_word("the c book is very easy!")); return 0; } int count_word(const char *s) { int i, wc = 0, waiting = 1; for (i = 0; s[i] != NULL; ++i) { if (isalpha(s[i]) ) { if (waiting ) { wc++; waiting = 0; else { waiting = 1; return wc ;
4
13번 #include<stdio.h> #define SIZE 10 int main(void) {
int list[SIZE] = {3, 2, 9. 7, 1, 4, 8, 0, 6, 5}; int i, j, temp, least; for(i = 0; i < SIZE - 1; i++) least = i; for(j = i + 1; j < SIZE; j++) least = j; } temp = list[i]; list[i] = list[least]; list[least] = temp; for(i = 0; i < SIZE; i++) printf("%d ", list[i]); printf("\n"); return 0;
5
14번 void swap(int *p, int *q) { int temp; temp = *p; *p = *q;
*q = temp; }
6
4. Q&A
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.