C++问题
人们为什么说C++难!难在哪里啊?#include <iostream>
using namespace std;
class Student
{public:
Student(int n,float s):num(n),score(s){}
void display() const;
void change(int n,float s) const;
private:
int num;
float score;
};
void Stundet::change(int n,float s)
{num=n;score=s;}
void Student::display()
{cout<<num<<" "<<score<<endl;}
int main()
{
const Student stud(101,78.5);
stud.display();
stud.change(101,80.5);
stud.display();
return 0;
}
这题错哪了