本文整理汇总了C++中Course类的典型用法代码示例。如果您正苦于以下问题:C++ Course类的具体用法?C++ Course怎么用?C++ Course使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Course类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print_course
void print_course()
{
int cIndex; // Index location of target course.
Course *tempCourse; // Pointer to target course object.
const LinkedList &cList = master_course_list(); //local reference to course list.
if(cList.size() < 1)
{
cerr << "\n*** The Course List is Empty ***" << endl;
return;
}
// Ask user which Course they want to see the enrollment for.
cIndex = find_course(cList);
// Check for error in find_course result.
if (cIndex == -1)
return; // Error message already displayed in find_course()
tempCourse = (Course*)cList[cIndex];
// Display the Course's student list using the method designed to do just that.
tempCourse->print_students();
}
示例2: TeaCouDelete
void TeaCouDelete(void)
{
Course* course;
int Number;
int again;
do
{
system("cls");
cin.clear();
cin.sync();
cout<<strTeaCD1;
INPUT_INT_L(Number,1);
course=data.CouSearch(Number);
if(course==NULL)
cout<<strTeaCDF;
else
{
cout<<strTeaCDConfirm1<<course->GetName()<<strTeaCDConfirm2<<course->GetNumber();
cout<<strTeaCDConfirm3<<course->GetCredit()<<strTeaCDConfirm4;
int i;
INPUT_INT_LU(i,0,1);
if(i)
{
data.DelCou(Number);
cout<<strTeaCDS;
}
}
cout<<strTeaCD2;
INPUT_INT_LU(again,0,1);
}while(again);
return;
}
示例3: 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);
}
}
示例4: setCourse
void EditorSession::setSkeleton(Skeleton *skeleton)
{
if (m_skeleton == skeleton) {
return;
}
m_skeleton = skeleton;
Language *language = m_language;
if (!m_language) {
language = m_resourceManager->languageResources().first()->language();
}
if (m_skeleton) {
bool found = false;
int resources = m_resourceManager->courseResources(language).count();
for (int i=0; i < resources; ++i) {
Course * course = m_resourceManager->course(language, i);
if (course->foreignId() == m_skeleton->id()) {
setCourse(course);
found = true;
break;
}
}
if (!found) {
setCourse(nullptr);
}
}
emit skeletonChanged();
}
示例5: hasCourse
bool Student::hasCourse(const int courseId){
for( int i=1; i<=courses.getLength(); i++ ){
Course c;
courses.retrieve(i,c);
if( c.getID() == courseId ) return true;
}
return false;
}
示例6: reset
void UdpClient::reset()
{
Course* course = Database::instance().getEventCourse();
location.horizontal = course->directionToNextControl(0);
location.vertical = PI/2;
location.position = course->controlPosition(0);
}
示例7: GetCourseWithFocus
void ScreenOptionsManageCourses::AfterChangeRow( PlayerNumber pn )
{
Course *pCourse = GetCourseWithFocus();
Trail *pTrail = pCourse ? pCourse->GetTrail( GAMESTATE->m_stEdit, GAMESTATE->m_cdEdit ) : nullptr;
GAMESTATE->m_pCurCourse.Set( pCourse );
GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail );
ScreenOptions::AfterChangeRow( pn );
}
示例8: main
int main()
{
Course newCourse;
cout << "Add Categories" << endl;
newCourse.addCategories();
cout << "Add Assignment" << endl;
newCourse.addAssignment();
system("pause");
return 0;
}
示例9: doModifyCourse
bool Database::doModifyCourse(const string& courseCode, const string& name,
const unsigned int& credit)
{
string courseError = "Course does not exist";
Course* course = courseRecord.search(Course(courseCode));
if(!course) throw courseError;
course->setName(name);
course->setCredit(credit);
}
示例10: Course
Course* CourseFiller::buildCourse(rapidjson::Value& courseJson){
std::string department = courseJson["department"].GetString();
std::string courseNumber = std::to_string(courseJson["courseNumber"].GetInt());
std::string courseName = courseJson["name"].GetString();
Course* course = new Course(department, courseNumber, courseName);
for(rapidjson::SizeType i = 0; i < courseJson["sections"].Size(); i++){
Section* section = CourseFiller::buildSection(courseJson["sections"][i]);
course->addSection(section);
}
return course;
}
示例11: getCodeFromInput
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;
}
示例12: add_course
void
add_course(LinkedList &sList, LinkedList &cList)
{
int sIndex; // Index location of target student.
int cIndex; // Index location of target course.
Student *tempStudent; // Pointer to target student object.
Course *tempCourse; // Pointer to target course object.
bool test; // Bool variable, for testing whether student was
// successfully added to a Course's List.
// If the student list is empty, no point in continuing.
if (sList.size() == 0)
{
cerr << "\n*** No Students in the List ***" << endl;
return;
}
// First get the student selection.
sIndex = find_student(sList);
// If that student was not found, display error message and return.
if (sIndex == -1)
{
cerr << "\n*** No Student of that Number in the List ***" << endl;
return;
}
tempStudent = (Student*)sList[sIndex];
// Get the course selection.
cIndex = find_course(cList);
// If that course was not found, return.
if (cIndex == -1)
return;
tempCourse = (Course*)cList[cIndex];
// Since everything is okay, add the course to the student's personal list
tempStudent->add_course(tempCourse);
// Now add the student to the Course's List of Students
test = tempCourse->add_student(tempStudent);
// Error checking.
if (test)
cout << "\nEnrollment for this Course updated successfully" << endl;
else
cerr << "\n*** Update of Enrollment for this course failed ***" << endl;
}
示例13: remove_student
void
remove_student()
{
int indexValue; // Index location of student to be removed.
bool test; // Test variable for removal of students from course lists.
Student *tempStudent; // Points to any student object
Course *tempCourse; // Points to any course object
LinkedList &sList = master_student_list(); // reference to master student list.
LinkedList &cList = master_course_list(); // reference to master course list.
if (sList.size() <= 0) // Attempts to acces an empty list may cause crashes.
{
cerr << "\n*** The List is Empty ***" << endl;
return;
}
// Ask the user for a student number and search for that student.
indexValue = find_student(sList);
if (indexValue == -1) // ie. if the student was not found!
{
cerr << "\n*** No Student of that Number in the List ***" << endl;
return;
}
// If the student WAS found then do the following.
// Remove student from the list and get a pointer to the student object.
tempStudent = (Student*)sList.remove(indexValue);
// Remove this student from all course lists.
for (int i = 0; i < cList.size(); i++)
{
tempCourse = (Course*)cList[i];
// Remove the Student from the Course's List of Students
// Note that remove_student checks if the student is in a particular
// course before doing anything.
test = tempCourse->remove_student(tempStudent);
}
// Now that the course lists have been cleaned up we can delete the student.
delete tempStudent;
// NO NEED to fill in the empty space created by shifting values "up".
// Since this is a linked list the objects are not placed sequentially
// in memory. The remove function just rearranges the links so that the
// object removed is no longer part of the link.
}
示例14: 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"));
}
示例15: db
bool CourseFiller::fill(CourseStore* store){
CourseStoreDB db("104.236.4.226", "/lookup/CS", "7819");
std::string* jsonString = db.getJson();
rapidjson::Document doc;
doc.Parse(jsonString->c_str());
for (rapidjson::SizeType i = 0; i < doc.Size(); i++){
Course* course = CourseFiller::buildCourse(doc[i]);
std::string name = course->getDepartment() + course->getCourseNumber();
course->getCombos();
store->insert(name, course);
}
delete jsonString;
return true;
}