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


C++ Course::getName方法代码示例

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


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

示例1: study

void CsStudent :: study(Course &course) {

    int r1 = rand() / (RAND_MAX / (GRADE_RANGE + 1));
    int r2 = rand() / (RAND_MAX / (GRADE_RANGE + 1));

    // If Student finished course succesfully:
    if (r1 < CS_QUIT_CHANCE) {
        writeToStudentsLogFile(
                this->_id,
                course.getName(),
                this->_department,
                QUITS_COURSE);
    } else if (r2 < course.getMinimumGrade()) {
        writeToStudentsLogFile(
                this->_id,
                course.getName(),
                this->_department,
                FAILED_COURSE);
    } else {
        this->finishcourse(course);

        writeToStudentsLogFile(
                this->_id,
                course.getName(),
                this->_department,
                FINISHED_COURSE);
    }
}
开发者ID:eldardamari,项目名称:spl-assignments,代码行数:28,代码来源:CsStudent.cpp

示例2: f

void UnitTests::TestID_3()
{
    // OK Test
    Course c;
    QFile f("course/datastructures.csv");
    if(f.open(QIODevice::ReadOnly)){
        while(!f.atEnd()){
            QString line = f.readLine();
            //cout << line.toStdString() << endl;
            c = LoadCourse(line);
        }
    }
    f.close();

    QVector<QString> prereqs = c.getPrerequisites();

    QCOMPARE(c.getDepartment(),QString("CS"));
    QCOMPARE(c.getNumber(),153);
    QCOMPARE(c.getName(),QString("Data Structures"));
    QCOMPARE(c.getHours(),3);
    QCOMPARE(c.getSemester(),QString("FS"));
    QCOMPARE(c.getIsRequired(),true);
    QCOMPARE(prereqs.size(),1);
    QCOMPARE(prereqs.at(0),QString("CS53"));

}
开发者ID:pts211,项目名称:CS206,代码行数:26,代码来源:unittests.cpp

示例3: study

void PGStudent::study(Course& c) {
    if (rand()%101 < 20) {
        // student is slacking off the course.
        Utils::log(_id, " is slacking off ", c.getName());
        return;  
    } 
    
    // the student handled the workload during the semester, now
    // he should try his luck at the exam.
    takeExam(c);
}
开发者ID:dvirazulay,项目名称:homework,代码行数:11,代码来源:pgstudent.cpp

示例4: study

void CSStudent::study(Course& c) {
    if (rand()%101 < 25) {
        // student didn't handle the workload and quit the course.
        Utils::log(_id, " quits course ", c.getName());
        return;  
    } 
    
    // the student handled the workload during the semester, now
    // he should try his luck at the exam.
    takeExam(c);
}
开发者ID:dvirazulay,项目名称:homework,代码行数:11,代码来源:csstudent.cpp

示例5: go

void QueryCourse::go()
{
    string code = getCodeFromInput();
    Course course = db.doQueryCourse(code);

    cout << endl;
    cout << "Code:   " << course.getCode() << endl;
    cout << "Name:   " << course.getName() << endl;
    cout << "Credit: " << course.getCredit() << endl;
    cout << endl;
    return;
}
开发者ID:byronyi-deprecated,项目名称:Register-new,代码行数:12,代码来源:Menu.cpp

示例6: updateCourse

void FileStorage::updateCourse(Course c){
	string search_string = to_string(c.getId());
	string replace_string = search_string + " " + c.getName() + " " + c.getDescription() + " ";
	for (vector<string>::size_type i = 0; i != c.getPreCourses().size(); i++) {
		replace_string += c.getPreCourses()[i] + " ";
	}
	replace_string += " $ " + to_string(c.getMaxStudents()); 

	string inbuf;
	fstream input_file(this->file_name, ios::in);
	ofstream output_file("result.txt");
	//Check for Error
	if (input_file.fail()){
		cerr << "Error Opening Data File";
		exit(1);
	}
	while (!input_file.eof()){
		getline(input_file, inbuf);

		int spot = inbuf.find(search_string);
		if (spot >= 0){
			string tmpstring = inbuf.substr(0, spot);
			tmpstring += replace_string;
			tmpstring += inbuf.substr(spot + inbuf.length(), inbuf.length());
			inbuf = tmpstring;
		}

		output_file << inbuf << endl;
	}
	input_file.close();
	output_file.close();

	int result;
	char oldname[] = "result.txt";
	char newname[] = "data.txt";
	remove(newname);
	result = rename(oldname, newname);
	if (result == 0)
		puts("File successfully updated\n");
	else
		perror("Course update error: Error renaming file\n");
}
开发者ID:RafaelBar,项目名称:CourseBid,代码行数:42,代码来源:file_storage.cpp


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