728x90
#include<stdio.h>
void main()
{
struct sungjuk
{
int hakbun;
char name[10];
int kor,eng,mat,total;
float avg;
};
sungjuk kim={10220,"kim",1,2,3};
sungjuk lee={10221,"lee",3,4,5};
kim.total=kim.kor+kim.eng+kim.mat;
lee.total=lee.kor+lee.eng+lee.mat;
kim.avg=kim.total/3;
lee.avg=lee.total/3;
printf("%d 이름 : %s | 국어[%d] 영어[%d] 수학[%d] 총점[%d] 평균[%.2f]\n",kim.hakbun,kim.name,kim.kor,kim.eng,kim.mat,kim.total,kim.avg);
printf("%d 이름 : %s | 국어[%d] 영어[%d] 수학[%d] 총점[%d] 평균[%.2f]\n",lee.hakbun,lee.name,lee.kor,lee.eng,lee.mat,lee.total,lee.avg);
}
'it > programming' 카테고리의 다른 글
| [c++] 구조체 배열 실습 (0) | 2012.11.05 |
|---|---|
| [C++] string.h 헤더파일의 strcat함수 구현하기 (0) | 2012.09.26 |
| [c++] 선형탐색(검색) (2) | 2012.09.10 |