📄 student.cpp
字号:
// Student.cpp: implementation of the Student class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include <iostream.h>
#include <iomanip.h>
#include "student.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Student::Student(float score1,float score2,float score3)
{
strcpy(name,"student");
math=score1;
phy=score2;
che=score3;
}
Student::~Student()
{
}
void Student::show() //输出学号,数理化成绩
{
cout<<endl;
cout<<setw(15)<<setiosflags(ios::left)<<num<<setw(15)<<math<<setw(15)<<che<<endl;
}
void Student::exchange(Student &a,Student &b) //交换两学生信息
{
Student temp;
temp.num=b.num;
temp.math=b.math;
temp.phy=b.phy;
temp.che=b.che;
b.num=a.num;
b.math=a.math;
b.phy=a.phy;
b.che=a.che;
a.num=temp.num;
a.math=temp.math;
a.phy=temp.phy;
a.che=temp.che;
}
void Student::setscore(int i) //询问设置成绩
{
cout<<"The No. "<<i<<" student"<<endl;
cout<<"Input the Maths score:"<<endl;
cin>>math;
cout<<"Input the Physics score:"<<endl;
cin>>phy;
cout<<"Input the Chemistry score:"<<endl;
cin>>che;
cout<<endl<<endl;
}
void Student::setscore(float s1,float s2,float s3) //直接设置成绩
{
math=s1; phy=s2; che=s3;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -