一看帖子标题“十万火急”就让人感到厌恶,但还是发一下源码
=========================================
/*
用类实现把八个同学的[学号,名字,性别及五门课]的成绩存入档案,当输入一个合法的学号时,
即能查询出该同学的情况.
要求:1.查询的结果姓名,性别及五门课的成绩
2.名字,学号,性别及五门课的成绩定义为学生类的私有成员.
(学号,学生名字,性别,课程名及成绩可以随便取.)
*/
#include<iostream.h>
#include<string.h>
class Student
{
float ID;
char NAME[20];
char SEX[10];
int SCORE[6];
public:
Student(float id=0712,char *name="笑谈",char *sex="男",int score1=0,int score2=0,int score3=0,int score4=0,int score5=0)
{
ID=id;
strcpy(NAME,name);
strcpy(SEX,sex);
SCORE[0]=score1;
SCORE[1]=score2;
SCORE[2]=score3;
SCORE[3]=score4;
SCORE[4]=score5;
}
void Display()
{
cout<<"==========================="<<endl;
cout<<"\t"<<"学号:"<<ID<<endl;
cout<<"\t"<<"姓名:"<<NAME<<endl;
cout<<"\t"<<"性别:"<<SEX<<endl;
cout<<"\t"<<"5门成绩是:"<<endl;
for(int i=0;i<=4;i++)
{ cout<<"\t"<<SCORE[i]<<endl; }
cout<<"==========================="<<endl;
}
};
void main()
{
Student Stu1(0701,"谈笑","男",61,62,63,64,65);
Stu1.Display();
}
=========================================
/*
用类实现把八个同学的[学号,名字,性别及五门课]的成绩存入档案,当输入一个合法的学号时,
即能查询出该同学的情况.
要求:1.查询的结果姓名,性别及五门课的成绩
2.名字,学号,性别及五门课的成绩定义为学生类的私有成员.
(学号,学生名字,性别,课程名及成绩可以随便取.)
*/
#include<iostream.h>
#include<string.h>
class Student
{
float ID;
char NAME[20];
char SEX[10];
int SCORE[6];
public:
Student(float id=0712,char *name="笑谈",char *sex="男",int score1=0,int score2=0,int score3=0,int score4=0,int score5=0)
{
ID=id;
strcpy(NAME,name);
strcpy(SEX,sex);
SCORE[0]=score1;
SCORE[1]=score2;
SCORE[2]=score3;
SCORE[3]=score4;
SCORE[4]=score5;
}
void Display()
{
cout<<"==========================="<<endl;
cout<<"\t"<<"学号:"<<ID<<endl;
cout<<"\t"<<"姓名:"<<NAME<<endl;
cout<<"\t"<<"性别:"<<SEX<<endl;
cout<<"\t"<<"5门成绩是:"<<endl;
for(int i=0;i<=4;i++)
{ cout<<"\t"<<SCORE[i]<<endl; }
cout<<"==========================="<<endl;
}
};
void main()
{
Student Stu1(0701,"谈笑","男",61,62,63,64,65);
Stu1.Display();
}