일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- html id
- #binary
- html multimedia
- html video
- #C++ has~a
- #자바상속#자바이즈어#is~a
- html object
- 하이퍼레저패브릭
- #성적관리프로그램
- #CallByAddress
- #C++ 연산자함수오버로딩
- #JAVASCRIPT
- html code
- docker example
- html plug-in
- html5 new tag
- 토큰경제
- #1차원배열
- #android activity
- relative path
- #3차원배열
- hyperledger transaction
- border-box
- mac terminal command
- html youtube
- #다차원포인터
- #2차원배열
- html charset
- #bubbleSort
- git flow
Archives
- Today
- Total
A sentimental robot
구조체 배열 본문
#include<stdio.h>
#pragma warning (disable:4996)
struct score
{
char name[10];
int kor;
int eng;
int mat;
int total;
float avg;
};
void main()
{
struct score aa[3]; // 구조체 aa가 3개 생겼당ㅎ
int i;
for (i = 0; i < 3; i++)
{
printf("Name input:");
scanf("%s", aa[i].name);
printf("Kor input:");
scanf("%d", &aa[i].kor);
printf("Eng input:");
scanf("%d", &aa[i].eng);
printf("Mat input:");
scanf("%d", &aa[i].mat);
aa[i].total = aa[i].kor + aa[i].eng + aa[i].mat;
aa[i].avg = aa[i].total / 3.f;
}
for (i = 0; i < 3; i++)
{
printf("%s\t", aa[i].name);
printf("%d\t", aa[i].kor);
printf("%d\t", aa[i].eng);
printf("%d\t", aa[i].mat);
printf("%d\t", aa[i].total);
printf("%f\n", aa[i].avg);
}
}
'C ' 카테고리의 다른 글
구조체배열 포인터 (0) | 2017.12.29 |
---|---|
구조체 포인터 (0) | 2017.12.29 |
구조체(typedef structure) (0) | 2017.12.29 |
배열포인터 활용 (0) | 2017.12.29 |
포인터배열과 더블포인터 (0) | 2017.12.29 |