C++_类
#include<iostream>
#include<algorithm>
using namespace std;
/**
* @project C++_Demo
* @author CaoPengCheng
* @date 2021-09-07
* @version 1.0.0
*/
class Student{
private:
int num;
float score;
public:
void setData(){
cout<<"input num:";
cin>>num;
cout<<"input score:";
cin>>score;
}
void disPlay(){
cout<<"num="<<num<<endl;
cout<<"score="<<score<<endl;
}
};
Student stud1,stud2;
int main(){
stud1.setData();
stud1.disPlay();
stud2.setData();
stud2.disPlay();
return 0;
}