当前位置: 首页>>代码示例>>C++>>正文


C++ Students::setName方法代码示例

本文整理汇总了C++中Students::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ Students::setName方法的具体用法?C++ Students::setName怎么用?C++ Students::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Students的用法示例。


在下文中一共展示了Students::setName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main()
{
    Teachers aTeacher;
    Students aStudent;
    GuestTeachers aGuestTeacher;

	int option = 0;
	int identity;
	int Points;
	if (Points < 0 || Points > 100)
    {
        cout << "Bad input! " << endl;
    }
	int EvaluationMark;
	if(EvaluationMark < 2 && EvaluationMark >6)
    {
        cout << "Bad input! " << endl;
    }
	int MonthlySalary;
	int passedDays;
	int SalaryForCourse;
	string Name;
	string Course;

	cout << "Get data for student with ID: 1" << endl;
	cout << "Get data for teacher with ID: 2" << endl;
	cout << "Get data for guest teacher with ID: 3" << endl;
	cout << "Add data for new student: 4" << endl;
	cout << "Add data for new teacher: 5" << endl;
	cout << "Add data for new guest	teacher: 6" << endl;

	unsigned short int arr[65535];

	while(true)
    {
        cout << "Enter option: ";
        cin >> option;
        {
            if(option == 7)
            {
                break;
            }
            if (option < 1 || option > 7)
            {
                cout << "Bad input! " << endl;
            }
            switch(option)
            {
            case 1:
                cout << aStudent.getID() << endl;
                cout << aStudent.getName() << endl;
                cout << aStudent.getCurrentCourse() << endl;
                cout << aStudent.getCurrentPoints() << endl;
                cout << aStudent.getAverageEvaluationMark() << endl;
                break;
            case 2:
                cout << aTeacher.getID() << endl;
                cout << aTeacher.getName() << endl;
                cout << aTeacher.getCurrentCourse() << endl;
                cout << aTeacher.getMonthlySalary() << endl;
                cout << aTeacher.getPassedDays() << endl;
                break;
            case 3:
                cout << aGuestTeacher.getID() << endl;
                cout << aGuestTeacher.getName() << endl;
                cout << aGuestTeacher.getCurrentCourse() << endl;
                cout << aGuestTeacher.getSalaryForCourse() << endl;
                break;
            case 4:
                cout << "Enter ID, Name, Current Course , Current Points and Average Evaliation Mark: "<< endl;
                cin >> identity >> Name >> Course >> Points >> EvaluationMark;
                aStudent.setID(identity);
                aStudent.setName(Name);
                aStudent.setCurrentCourse(Course);
                aStudent.setCurrentPoints(Points);
                aStudent.setAverageEvaluationMark(EvaluationMark);
                cout << "A student profile has been added." << endl;
                break;
            case 5:
                cin >> identity >> Name >> Course >> MonthlySalary >> passedDays;
                aTeacher.setID(identity);
                aTeacher.setName(Name);
                aTeacher.setCurrentCourse(Course);
                aTeacher.setMonthlySalary(MonthlySalary);
                aTeacher.setPassedDays(passedDays);
                cout << "A teacher profile has been added." << endl;
                break;
            case 6:
                cin >> identity >> Name >> Course >> SalaryForCourse;
                aGuestTeacher.setID(identity);
                aGuestTeacher.setName(Name);
                aGuestTeacher.setCurrentCourse(Course);
                aGuestTeacher.setSalaryForCourse(SalaryForCourse);
                cout << "A guest teacher profile had been added." << endl;
                break;
            }
        }
    }

	return 0;
//.........这里部分代码省略.........
开发者ID:kilarionov,项目名称:cppTopics,代码行数:101,代码来源:dom3+(1).cpp


注:本文中的Students::setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。