C언어/Homework 3

[C언어] 구조체 포인터와 배열을 이용한 탐색과 정렬

#include struct student { char name[8]; int hakbun; float grade; }; struct student s1 = { "홍길동",2020006,3.2 }; struct student s2 = { "임꺽정",2020004,2.7 }; struct student s3 = { "이순신",2020002,4.3 }; struct student s4 = { "김유신",2020001,3.3 }; struct student s5 = { "강감찬",2020003,3.8 }; struct student s6 = { "김선달",2020005,1.5 }; struct student* student[6] = { &s1,&s2,&s3,&s4,&s5,&s6 }; struct student..

C언어/Homework 2022.03.28

[C언어] 묻고 더블로 가!

#include #include struct values //구조체를 이용해 값을 입력받을 변수 4개를 생성해준다. { int n1, n2; double x1, x2; }; void print_values(struct values *s1) //변수를 출력해줄 함수이다. { printf("n1=%d, n2=%d, x1=%f, x2=%f\n", s1->n1, s1->n2, s1->x1, s1->x2); } void double_values(struct values *s1) //입력받은 변수를 2배로 곱해준다. { s1->n1 = s1->n1 * 2; s1->n2 = s1->n2 * 2; s1->x1 = s1->x1 * 2; s1->x2 = s1->x2 * 2; } int main() { struct valu..

C언어/Homework 2022.03.14