| 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 32 | #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #define SIZE 3 struct student { int number; char name[20]; double grade; }; int main(void) { struct student list[SIZE]; int i; for (i = 0; i < SIZE; i++) { printf("학번을 입력하시오: "); scanf("%d", &list[i].number); printf("이름을 입력하시오: "); scanf("%s", list[i].name); printf("학점을 입력하시오(실수): "); scanf("%lf", &list[i].grade); printf("\n"); } printf("\n=================================================\n"); for (i = 0; i < SIZE; i++) printf("학번: %d, 이름: %s, 학점: %f\n", list[i].number, list[i].name, list[i].grade); printf("=================================================\n"); return 0; } | cs |


https://itsys.hansung.ac.kr/cgi-bin/onlineTest/viewCcoding/onlineCcoding.cgi?source=src/chap11/array_of_struct.c
C프로그래밍(프로그래밍언어) 실습게시판