首页 > 学院 > 开发设计 > 正文

fig3.7

2019-11-06 06:33:21
字体:
来源:转载
供稿:网友

fig3.7

#include<iostream>#include<string>using namespace std;class GradeBook{public:	explicit GradeBook(string name)		:courseName(name)	{	}	void setCourseName(string name)	{		courseName = name;	}	string getCourseName() const	{		return courseName;	}	void disPlayMessage() const	{		cout << "Welcome to the grade book for/n" << getCourseName()			<< "!" << endl;	}PRivate:	string courseName;};int main(){	GradeBook gradeBook1("cs101 Introduction to c++ programming");	GradeBook gradeBook2("cs102 Data Structures in c++");	cout << "gradeBook1 creat for course: " << gradeBook1.getCourseName()		<< "/ngradeBook2 creat for course: " << gradeBook2.getCourseName()		<< endl;	system("pause");	return 0;}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表