c 언어 작성하는것좀 도와주세요
참이
1. 구조체 이름이 student 이고 멤버가 아래와 같은 구조체를 선언하시오.
구조체명
student
멤버명
name[10]
kor
eng
math
형식
char
int
int
int2. 다음 박스와 같은 데이터가 입력되도록 1번의 구조체를 이용하여 구조체 배열 stu[5]를 선언하고 main( )의 프로그램 코드상에서 초기화 하시오.
?xml:namespace prefix = v ns = urn:schemas-microsoft-com:vml /?xml:namespace prefix = v /?xml:namespace prefix = v /?xml:namespace prefix = v /?xml:namespace prefix = w ns = urn:schemas-microsoft-com:office:word /?xml:namespace prefix = w /?xml:namespace prefix = w /?xml:namespace prefix = w /Kim 95 95 90
Park 90 85 90
Lee 95 95 95
Hong 85 85 90
Oh 85 85 85
3. 학생의 이름, 국어, 영어, 수학점수를 출력하는 함수를 작성하시오.
(반드시 멤버처리 시 dot(.)을 사용할 것)
void Print_Out(struct student *p)
hint main( )
{
‥‥‥‥‥
‥‥‥‥‥
Print_Out(stu);
}
결과-------------------------------------------------------------------------------------------------
위에는 문제의 내용입니다 제가 만들어본것은 아래와 같습니다.
-----------------------------------------------------------------
#include stdio.h
typedef struct student
{
char name[10];
int kor, eng, math;
} student;
void Print_Out(struct student *p);
int main(void)
{
struct student stu[5] = {
{Kim, 95, 95, 90},
{Park, 90, 85, 90},
{Lee, 95, 95, 95},
{Hong, 85, 85, 90},
{Oh, 85, 85, 85}
};
Print_Out(stu);
return 0;
}
void Print_Out(struct student *p)
{
struct student stu[5];
int i;
for(i = 0; i 5; i++)
{
printf(%s %3d %3d %3d,
stu[i].name, stu[i].kor, stu[i].eng, stu[i].math);
};
}
------------------------------------------------------------------------------------------------------
빌드해보면 오류는 안나는데 배운지 얼마안되서 어디가 잘못된지 모르곘습니다.
틀린부분 수정과 함께 그분분을이해할수 있게도와주세요. 수고하세요