|
안녕하세요???
수고가 많으십니다~~
헤헷*^^*
다름이 아니궁..
저는 중3 여학생인데요
어떤 계기로 해서...
c++언어를 접하게 되었어요~
구런데..
그게...
첨 부터 배운것두 아니구...
해서~
어려운 점이 만거든요~~
아시는 분 좀 ..
꼭 멜이나...
이 글 밑에 답 좀 달아주세요~~~
꼭 좀 부탁드립니다~~~~~~~~~~
도와주세요!!!!!!!!!!!!!!
=================================================================================
[문제1] 다음의 성적 프로그램을 클래스 배열을 이용하여 작성하였다.
( ) 안에 알맞은 내용을 쓰시오.
=============================================
학 번 이 름 국어 영어 수학 총점 평균
=============================================
30101 김소라 99 88 77 264 88.00
30102 아름이 78 98 87 263 87.67
30103 박희정 89 100 83 272 90.67
30104 정다워 97 92 80 269 89.67
30105 이정진 91 90 81 262 87.33
============================================
#include
#include
#include
const int SU=5;
const int KW=3;
class sungjuk{
private:
int hakbun;
char *irum;
int jumsu[KW], tot;
public:
void prin1(class sungjuk *);
void prin2(void);
};
inline void sungjuk::prin1(class sungjuk sung[]){
cout<<"\n=============================================\n";
cout<<"학 번 이 름 국어 영어 수학 총점 평균\n";
cout<<"\=============================================\n";
for(int a=0; a
( ? )
cout<<"============================================ \n";
}
inline void sungjuk::prin2(void){
cout< };
void main(void){
clrscr();
class sungjuk sung[]={
{30101,"김소라", 99, 88, 77 },
{30102,"아름이", 78, 98, 87 },
{30103,"박희정", 89, 100, 83 },
{30104,"정다워", 97, 92, 80 },
{30105,"이정진", 91, 90, 81 }
};
class sungjuk su;
su.prin1(sung);
getch();
}
[문제2] 위의 성적 프로그램을 클래스 포인터를 이용하여 작성하였다.
( ) 안에 알맞은 내용을 쓰시오.
#include
#include
#include
const int SU=5;
const int KW=3;
class sungjuk{
private:
int hakbun;
char *irum;
int jumsu[KW], tot;
public:
void prin1(class sungjuk *);
void prin2(void);
};
inline void sungjuk::prin1(class sungjuk *sung){
cout<<"\n=============================================\n";
cout<<"학 번 이 름 국어 영어 수학 총점 평균\n";
cout<<"\=============================================\n";
for(int a=0; a
( ? )
cout<<"============================================ \n";
}
inline void sungjuk::prin2(void){
cout< };
void main(void){
clrscr();
class sungjuk sung[]={
{30101,"김소라", 99, 88, 77 },
{30102,"아름이", 78, 98, 87 },
{30103,"박희정", 89, 100, 83 },
{30104,"정다워", 97, 92, 80 },
{30105,"이정진", 91, 90, 81 }
};
class sungjuk *su;
su->prin1(sung);
getch();
}
[문제3] 프렌드 함수를 이용하여 전용데이터에 접근하는 프로그램을 작성하였다.
( ) 안에 알맞은 내용을 쓰시오.
#include
#include
#include
#include
class sawon{
private:
char irum[14];
char jumin[15];
int age;
public:
void init(char *, char *, int);
friend void print(class sawon p1);
};
void sawon::init(char *ir, char *ju, int ag){
strcpy(irum, ir);
strcpy(jumin, ju);
age=ag;
}
void main(void){
clrscr();
sawon sa1, sa2;
sa1.init("정다워","750929-1401110",17);
sa2.init("한소라","751212-2402222",16);
print(sa1);
print(sa2);
getch();
}
void print(class sawon p1){
cout<<"이름: "<< ( ? ) <<"\n";
cout<<"주민등록번호:"<< ( ? )<<"\n";
cout<<"나이: "<< ( ? ) <<"\n";
}
|