~cpp
#include<iostream>
using namespace std;
#include<iostream> //strcpy()
#include"SungJuk.h"
SungJuk::SungJuk()
{
strcpy(m_szName, "이름없음");
m_nKorean = 0;
m_nEnglish = 0;
m_nMath = 0;
m_nTotal = 0;
m_dAvg = 0.0;
}
int SungJuk::GetTotal()
{
return m_nTotal;
}
void SungJuk::PrintResult()
{
cout<< " " << m_nNumber << "\t" << m_szName<< "\t" << m_nKorean << "\t"
<< m_nEnglish << "\t" << m_nMath << "\t" <<m_nTotal << "\t"
<<m_dAvg << endl;
}
void SungJuk::TopTotal_Print()
{
cout<<"\n 전체수석 " << "\t" << "번 호 : "<< m_nNumber << "\n"
<<"\t\t"<< "이 름 : "<< m_szName << "\n" <<"\t\t"<<"총 점 : "
<< m_nTotal << "\n";
}
void SungJuk::TopKorean_Print()
{
cout<<"\n 국어수석 " << "\t" << "번 호 : "<< m_nNumber << "\n"
<<"\t\t"<< "이 름 : "<< m_szName << endl <<"\t\t"<<"국 어 : "
<< m_nKorean << endl;
}
void SungJuk::TopEnglish_Print()
{
cout<<"\n 영어수석 " << "\t" << "번 호 : "<< m_nNumber << endl
<<"\t\t"<< "이 름 : "<< m_szName << endl <<"\t\t"<<"영 어 : "
<< m_nEnglish << endl;
}
void SungJuk::TopMath_Print()
{
cout<<"\n 수학수석 " << "\t" << "번 호 : "<< m_nNumber << endl
<<"\t\t"<< "이 름 : "<< m_szName << endl <<"\t\t"<<"수 학 : "
<< m_nMath << endl;
}
const SungJuk & SungJuk::Top_Avg(const SungJuk &s) const
{
if (s.m_nTotal > m_nTotal)
return s;
else
return *this;
}
const SungJuk & SungJuk::Top_Korean(const SungJuk &s) const
{
if (s.m_nKorean > m_nKorean)
return s;
else
return *this;
}
const SungJuk & SungJuk::Top_English(const SungJuk &s) const
{
if (s.m_nEnglish > m_nEnglish)
return s;
else
return *this;
}
const SungJuk & SungJuk::Top_Math(const SungJuk &s) const
{
if (s.m_nMath > m_nMath)
return s;
else
return *this;
}
void SungJuk::Input(int nNumber, char szName[], int nKorean, int nEnglish, int nMath)
{
strcpy(m_szName,szName);
m_nNumber = nNumber;
m_nKorean = nKorean;
m_nEnglish = nEnglish;
m_nMath = nMath;
m_nTotal = m_nKorean + m_nEnglish + m_nMath;
m_dAvg = m_nTotal / 3;
}
const int caucse = 10;
void main()
{
SungJuk score[caucse];
score[0].Input(1,"Park",85,93,92);
score[1].Input(2,"kang",96,93,100);
score[2].Input(3,"Jang",87,89,94);
score[3].Input(4,"Jung",86,97,93);
score[4].Input(5,"Shin",94,90,92);
score[5].Input(6,"Lee",89,96,87);
score[6].Input(7,"Kim",98,93,96);
score[7].Input(8,"Min",83,87,82);
score[8].Input(9,"Mun",89,96,92);
score[9].Input(10,"Han",91,99,100);
for(int i=0; i< caucse; i++)
score[i].PrintResult();
}