[3번]//hello.h#pragma oncevoid hello(char *name); //hello.c#include #include "hello.h" void hello(char *name){printf("안녕 %s\n", name);} //main.c#include #include "hello.h" int main(void){hello("철수");return 0;} ====================================== [4번]//array.h#pragma once int get_sum_of_array(int a[], int size);void print_array(int a[], int size); //array.c#include #include "array.h" int get_su..
//프로그래밍 1번#include #include typedef struct rec {int i;float PI;char A;} my_record; int main(void){my_record *p = (my_record *)malloc(sizeof(my_record));if (p == NULL) {printf("메모리 할당 오류\n");exit(1);} p->i = 10;p->PI = 3.14;p->A = 'a'; printf("%d\n", p->i);printf("%f\n", p->PI);printf("%c\n", p->A); free(p);return 0;} =============================================================== //프로그래밍 2번#incl..
//프로그래밍 3번#include #include int main(void){FILE *f;char ch;int line = 0; f = fopen("line.txt", "r");if (f == NULL) {fprintf(stderr, "텍스트 파일 line.txt를 열 수 없습니다.\n");exit(1);} while ((ch = getc(f)) != EOF) {if (ch == '\n')line++;putchar(ch);}fclose(f);printf("\n라인의 개수=%d\n", line);return 0;} ========================================================================== //프로그래밍 4번#include #include int ..
// 프로그래밍 6번#include enum game { scissor, rock, paper }; int main(void){enum game computer = scissor;//가위enum game user = scissor;printf("가위(0), 바위(1), 보(2)를 입력하시오: ");scanf("%d", &user); if (user == scissor)//if (computer == user)printf("비겼습니다.\n");else if (user == rock)printf("컴퓨터가 졌습니다.\n");elseprintf("컴퓨터가 이겼습니다.\n"); return 0;} ==============================================================
// 연습문제 10번 응용 - Nested Structure 로 두 좌표의 일치여부 검사#include struct point {int x;int y;}; struct equal {struct point p1;struct point p2;}; int equal(struct point p1, struct point p2); int main(void){struct equal p;p.p1.x = 1;p.p1.y = 2;p.p2.x = 1;p.p2.y = 2; printf("일치 여부: %d\n", equal(p.p1, p.p2));} int equal(struct point p1, struct point p2){if (p1.x == p2.x && p1.y == p2.y)return 1;elsereturn 0;..
//두개도 가능하다#include #include struct student {int number;char name[10];double grade;}; int main(void){struct student s;struct student m; s.number = 20170001;strcpy(s.name, "홍길동");s.grade = 4.3; m.number = 20170002;strcpy(m.name, "심청");m.grade = 4.0; printf("학번: %d\n", s.number);printf("이름: %s\n", s.name);printf("학점: %f\n", s.grade);printf("학번: %d\n", m.number);printf("이름: %s\n", m.name);printf("학점..
// 단어의 개수를 세는 프로그램#include #include #include int main(void){char input[100];int i, count = 0; printf("텍스트를 입력하시오: ");gets_s(input, 99); count = count_word(input);printf("단어의 개수: %d\n", count);return 0;} int count_word(const char *s){int i, wc = 0, waiting = 1;//waiting: 깃발 들고 있음. count가 됨.//file을 쓰고 있다고 flag = 1이라고 알리고, 다른 사람은 flag=0이 될 때까지 기다려야함//DB에 동시에 접속해서 쓸 수 있게끔 만들 수 있음for (i = 0; s[i] != ..
// 다양한 방법으로 문자열 입력해보기#include int main(void){char str1[6] = "Seoul";char str2[3] = { 'i', 's', '\0' };char str3[] = "the caputal city of Korea.";str1[0] = 's'; //str1의 첫 번째 글자를 바꿔준다.printf("%s %s %s\n", str1, str2, str3); return 0;} ==================================================================== //망한거같은데 1#include int main(void){char str[100];printf("문자열 입력: ");scanf("%s", str); int i = 0;w..
// Call_by_Value #include void swap(int x, int y){int temp; temp = x;x = y;y = temp;} int main(void){int a = 10, b = 20;printf("swap() 호출전 a = %d, b = %d \n", a, b); swap(a, b);printf("swap() 호출후 a = %d, b = %d \n", a, b);return 0;} // swap() 함수가 실행되지 않는다.// return 값은 1개이므로 값이 넘어올 수가 없다. 2개니까. ==================================================================== // Call_by_Reference #include void..
- Total
- Today
- Yesterday
- k라이프트렌드트렌드쇼2018
- 프리파라썸머페스티벌
- AIexpoKorea
- 인공지능박람회
- 붙이는젤네일
- C언어
- 프리파라
- 2018서울국제도서전
- 국제인공지능대전
- 어반디케이
- k라이프트렌드쇼
- 2018프리파라썸머페스티벌
- 프썸페
- c프로그래밍기초
- 롱라스팅강자
- 리뷰
- 올나이트픽서
- 젤네일스티커
- 어반디케이픽서
- 수업
- 박람회
- 예제응용
- 싱글즈품평단
- 매직젤스트립
- 데싱디바
- 2018-1학기
- 국민픽서
- AI박람회
- 물광아트젤
- 여름엔국민픽서
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |