本文整理汇总了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);
}
}
示例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"));
}
示例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);
}
示例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);
}
示例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;
}
示例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");
}