#include
#include
using namespace std;
class Student
{
private:
string SName;
string SNo;
string SScore[10];
public :
void init();
void print();
};
void Student::init()
{
cout<<"请输入学生姓名:";
cin>>this->SName;
cout<<"学号:";
cin>>this->SNo;
cout<<"各科成绩:";
for(int i=0;i<10;i++)
{
cin>>this->SScore[i];
}
}
void Student::print()
{
cout<<"学生信息:姓名:"<
{
cout<
cout<
int main()
{
Student s;
s.init();
s.print();
return 0;
}
#include
#include
using namespace std;
class student
{
private:
string studentName;
int studentId;
float studentScore[10];
public:
student(string name, int id, float *score)
{
studentName = name;
studentId = id;
for(int i = 0; i < 10; ++i)
{
studentScore[i] = score[i];
}
}
float average()
{
float temp = 0.0;
for(int i = 0; i < 10; ++i)
{
temp += studentScore[i];
}
temp = temp / 10.0;
return temp;
}
void print()
{
cout<<"name: "<
for(int i = 0; i < 10; ++i)
cout<
};
void main()
{
string name;
int id;
float score[10];
float aveScore;
cout<<"please input student name,id and scores"<
cin>>id;
for(int i = 0; i < 10; ++i)
cin>>score[i];
student studentA(name, id, score);
studentA.print();
return ;
}