#include <stdio.h> #include <stdlib.h> #include <string.h> char *get_str(void); int main(void) { char *p[100]; char *pt; int i = 0, cnt; while(1) { pt = get_str(); if(*pt == '\0') break; p[i] = pt; i++; } cnt = i; for(i = 0; i < cnt; i++) { printf("%s\n", p[i]); } for(i = 0; i < cnt; i++) { free(p[i]); } return 0; } char *get_str(void) { char temp[800];..
#include <stdio.h> int sum(int a, int b) { return (a + b); } int mul(int a, int b) { return (a * b); } int max(int a, int b) { return (a > b) ? a : b; } int main(void) { char *ts[3] = {"합", "곱", "맥스"}; int(*fp[3])(int, int) = {sum, mul, max}; int i, res; for(i = 0; i < 3; i++) { res = fp[i](10, 20); printf("%s : %d\n", ts[i], res); } return 0; }
1 2 3 4 5 가로합 6 7 8 9 10 가로합 11 12 13 14 15 가로합 16 17 18 19 20 가로합 세로합 세로합 세로합 세로합 세로합 가로세로 총합 #include <stdio.h> int main(void) { int ary[5][6]= {{1,2,3,4,5},{6,7,8,9,10},{11,12,13,14,15},{16,17,18,19,20}}; int i,j; for(i=0; i<4; i++) { for(j=0; j<5; j++) { ary[4][j]+=ary[i][j]; ary[i][5]+=ary[i][j]..
#include <stdio.h> int main(void) { char ary[10]; int ch; int weight = 1; int tot = 0; int i = 0; while((ch = getchar()) != '\n') { ary[i++] = ch; } while(i > 0) { tot += ((ary[--i] - '0') * weight); weight *= 10; } printf("%d\n", tot + 10); return 0; } ------------------------------------------------ 100000000 --> 입력값 100000010 --> 출력값
#include <stdio.h> #include <stdlib.h> double get_next(void); //함수선언 double ary[]={0.1,0.3,0.5,0.7,0.9}; //전역 배열 int main(void) { double res=0; int i; for(i=0;i<5;i++) { res+=get_next(); } printf("%.1lf",res); return 0; } // 여기까지만 보고 get_next()함수를 어떻게 작성해야 할까를 고민하는 문제 double get_next(void) { sta..
#include <stdio.h> #include <stdlib.h> void swap(double *pa, double *pb); int main(void) { double a=1.5, b=3.4; swap(&a,&b); printf("a:%.1lf, b:%.1lf",a,b); return 0; } void swap(double *pa, double *pb) { double pt; pt=*pa; *pa=*pb; *pb=pt; } ------------------------------------------- a:3.4, b:1.5
1. 내가 한 것 : strcmp() 이용 #include <stdio.h> int main(void) { char word1[1000]={0}, word2[1000]={0}, word3[1000]={0}; char input[1000]; printf("세 단어 입력 : "); scanf("%s%s%s",word1, word2, word3); if(strcmp(word1,word2)<=0) { if(strcmp(word1,word3)<=0) { if(strcmp(word2,word3)<=0) { printf("%s %s %s",word1,word2,word3); } else printf("%s %s %s"..
- Total
- Today
- Yesterday
- powershell
- virt-sysprep
- vmware
- sysprep
- dp-1
- 정렬
- 스토리지
- 대소문자
- cloud-init
- 중복제거
- 부동없이
- 3par
- LIST
- 읽어오기
- dp-2
- vmware.powercli
- storage
- exadata
- EXA
- fromkeys
- set()
- Join
- 배열
- 변수화
- dezoomify
- artandculture
- powercli
- oracle
- 차집합
- insert
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |