|
성적관리프로그램에서요....
석차를 구하려하는데...
어찌해야할지...
잘 안나오네요.....
초보라서요....
도와주세요~~~~
#include<iostream.h>
class student{
public:
char name[50];
int kor,eng,math,total,ave;
};
int chong;
void soo(student *temp);
void ib(student *temp);
void gae(student *temp);
void chul(student *temp);
void main()
{
student temp[5];
soo(temp);
ib(temp);
gae(temp);
chul(temp);
}
void soo(student *temp)
{
cout<<"\t\t성적처리 프로그램입니다...^^\n"<<endl;
cout<<"\t총 학생수를 입력하세요..."<<endl;
cin>>chong;
}
void ib(student *temp)
{
for(int i=0; i<chong; i++){
cout<<"\n\t이름을 입력하시오 : " ;
cin>> temp[i].name;
cout<<"\n\t국어점수 입력 : " ;
cin>> temp[i].kor;
cout<<"\n\t영어점수 입력 : " ;
cin>> temp[i].eng;
cout<<"\n\t수학점수 입력 : " ;
cin>> temp[i].math;
}
}
void gae(student *temp)
{
for( int i=0; i<chong; i++)
{
temp[i].total = temp[i].kor + temp[i].eng + temp[i].math;
temp[i].ave = temp[i].total / 3;
}
}
void chul(student *temp) //prn()함수를 구현한내용
{
cout<< "\n\n\t총인원수는 : "<<chong<<"명 입니다"<<endl;
cout << "\n이름\t국어\t영어\t수학\t총점\t평균\t석차\n";
cout << "----------------------------------------------------------------\n";
for( int i=0; i<chong; i++)
{
cout << temp[i].name <<"\t";
cout << temp[i].kor <<"\t";
cout << temp[i].eng <<"\t";
cout << temp[i].math <<"\t";
cout << temp[i].total <<"\t";
cout << temp[i].ave << "\n";
}
cout << "----------------------------------------------------------------\n";
}
/*
void rank( )
{
}
*/
|