본문 바로가기

분류 전체보기

(1789)
배열의 기본 #include <stdio.h> main() { int gameScores[10] = { 12, 5, 21, 15, 32, 10}; int totalPoints = 0; int i; float avg; for(i = 6; i < 10; i++) { printf("게임 %d에서 선수의 득점은? ", i + 1); scanf(" %d", &gameScores[i]); } for(i = 0; i<10; i++) { totalPoints += gameScores[i]; } avg = ((float)totalPoints / 10); printf("\n\n선수의 평균 득점은 %.1f.\n", a..
movie #include <stdio.h> #include <string.h> main() { int ctr, numMovies, rating, favRating, leastRating; char movieName[40], favorite[40], least[40]; favRating = 0; leastRating = 10; do{ printf("금년에 영화를 몇 편이나 보았습니까? "); scanf(" %d", &numMovies); if(numMovies < 1) { printf("영화수가 0입니다. \n다시 입력하시오!\n\n"); } } whi..
initial #include <stdio.h> main() { char firstInitial; char lastInitial; int age; int favorite_numberl printf("이름(영어로)은 무슨 글자로 시작합니까? \n"); scanf(" %c", &firstInitial); printf("성(영어로)은 무슨 글자로 시작합니까? \n"); scanf(" %c", &lastInitial); printf("나이는 몇 살인가요?? \n"); sacnf(" %d", &age); printf("제일 좋아..
fahr >> upper #include <stdio.h> main() { int fahr, celsius; int lower, upper, step; lower = 0; upper = 300; step = 20; fahr = lower ; while (fahr <= upper){ celsius = 5 * (fahr-32) / 9; printf("%d\t%d\n", fahr, celsius); fahr = fahr + step; } }
chess #include <stdlib.h> int numcmp(char *s1, char *s2) { double v1, v2; v1 = atof(s1); v2 = atof(s2); if (v1 < v2) return -1; else if (v1 > v2) return 1; else return 0; } void swap(void *v[], int i, int j) { void *temp; temp = v[i]; v[i] = v[j]; v[j] = temp; }
factorial #include <stdio.h> main() { int number, factorial; printf("정수를 입력하시오: "); scanf("%d", &number); factorial = 1; while (number > 0){ factorial = factorial*number; --number; } printf("팩토리얼값(n!)=%d \n", factorial); return 0; }
ID의 원리 #include <stdio.h> main() { int ctr; int idSearch; int found = 0; int custID[10] = { 313, 453, 502, 101, 892, 475, 792, 912, 343, 633 }; float custBal[10] = { 0.00, 45.43, 71.23, 301.56, 9.08, 192.41, 389.00, 229.67, 18.31, 59.54 }; printf("\n\n*** 고객 카드 사용액 검색 ***\n"); printf("어떤 고객의 카드 사용액을 검색하시겠습니까? "); scanf(" %..
<독서 천재가 된 홍대리> 책 내용에는 크게 동감하지는 않지만 평소에 정회일 작가를 좋아하는 편이다 힘든 일과 좌절을 많이 겪었음에도 꿋꿋하게 이겨나간 그의 모습이 정말 멋있다 그에게 박수를 보낸다