6.cpp

<img src="https://img-blog.csdn.net/20150419111357242" alt="" />#include <iostream> 
using namespace std; 
class Student 
{ public:  
 Student(int n,float s):num(n),score(s){} 
 void change (int n,float s){num=n;score=s; }
 void display(){cout<<num<<""<<score<<endl; }; 
 private: 
int num; 
float score; 
}; 
int main()  
{
	Student stud(101,78.5);
	stud.display();
	stud.change(101,80.5);
	stud.display();
	return 0;
	}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章