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


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

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


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

示例1:

// 课程类拷贝构造函数
Course::Course(const Course& course){
    id = course.GetId();
    name = course.GetName();
}
开发者ID:yyhclimacool,项目名称:cmsys,代码行数:5,代码来源:Course.cpp

示例2: PQconnectdb

void    Configuration::ReadDatabase() {
  _professors.clear();
  _studentGroups.clear();
  _courses.clear();
   _rooms.clear();
  _courseClasses.clear();
  mapid.clear(); 
  PGconn     *conn;
  PGresult    *res, *resgr;
  int     rec_count, rec_countgr;
  int row,row1,col;
  
  conn = PQconnectdb("dbname=gaschedule_development host=localhost user=alex password=alex");
  if (PQstatus(conn) == CONNECTION_BAD) 
  { puts("We were unable to connect to the database");}
  
  res = PQexec(conn,"select * from rooms order by id");
  if (PQresultStatus(res) != PGRES_TUPLES_OK) {puts("We did not get any data!");}
         
  rec_count = PQntuples(res);
  for (row=0; row<rec_count; row++) {
    int id =   atoi(PQgetvalue(res, row , 0));
    char* name =  PQgetvalue(res, row , 1) ;
    bool lab = !strcmp ( PQgetvalue(res, row , 2), "t" );
    int size = atoi(PQgetvalue(res, row , 3));
    Room* r =  new Room(name, lab, size ); 
                    
    int a = row;
    a = a + 1;
    mapid.insert(pair <int,int> (a,id));
        
    if( r ) {
      _rooms.insert( pair<int, Room*>( r->GetId(), r ) );
    }
  }
  PQclear(res);
 
  res = PQexec(conn, "select * from courses order by id");
  if (PQresultStatus(res) != PGRES_TUPLES_OK) { puts("We did not get any data!");}
  rec_count = PQntuples(res);
       
  for (row=0; row<rec_count; row++) {
    int id =   atoi(PQgetvalue(res, row , 0));
    char* name =  PQgetvalue(res, row , 1) ; 
    
    Course* r =  new Course(id, name  );  
    if( r )
        _courses.insert( pair<int, Course*>( r->GetId(), r ) );
    }
    PQclear(res);

    res = PQexec(conn,"select * from professors order by id");
    if (PQresultStatus(res) != PGRES_TUPLES_OK) { puts("We did not get any data!");}
    rec_count = PQntuples(res);

    for (row=0; row<rec_count; row++) {
      int id =   atoi(PQgetvalue(res, row , 0));
      char* name =  PQgetvalue(res, row , 1) ;
      Professor* r =  new Professor(id, name  );  
      if( r )
        _professors.insert( pair<int, Professor*>( r->GetId(), r ) );
      }
      PQclear(res);
      res = PQexec(conn,"select * from groups order by id");
      if (PQresultStatus(res) != PGRES_TUPLES_OK) { puts("We did not get any data!");}
      rec_count = PQntuples(res);
      
      for (row=0; row<rec_count; row++) {
        int id =   atoi(PQgetvalue(res, row , 0));
        char* name =  PQgetvalue(res, row , 1) ;
        int size = atoi(PQgetvalue(res, row , 2));      
        StudentsGroup* r =  new StudentsGroup(id, name , size );  
        if( r ) {
          _studentGroups.insert( pair<int, StudentsGroup*>( r->GetId(), r ) );
        }
      }
      PQclear(res);
 
      list<StudentsGroup*> groups;
             
      res = PQexec(conn, "select * from clas order by id");
      if (PQresultStatus(res) != PGRES_TUPLES_OK) {puts("We did not get any data!");}
      rec_count = PQntuples(res);           
      resgr = PQexec(conn,
        "select clas.id, cla_groups.group_id from cla_groups INNER JOIN clas ON  cla_groups.cla_id = clas.id");
                       
      if (PQresultStatus(resgr) != PGRES_TUPLES_OK) {puts("We did not get any data!");  }
      rec_countgr = PQntuples(resgr);

      for (row=0; row<rec_count; row++) {
        int claid = atoi(PQgetvalue(res, row , 0));
        int pid =   atoi(PQgetvalue(res, row , 1));
        int  cid = atoi(PQgetvalue(res, row , 2));
        int dur  = atoi(PQgetvalue(res, row , 4));
        bool lab = !strcmp ( PQgetvalue(res, row , 5), "t" );
        
        Professor* p = GetProfessorById( pid );
        Course* c = GetCourseById( cid );
        
        for (row1=0; row1<rec_countgr; row1++) {
//.........这里部分代码省略.........
开发者ID:dimarymar,项目名称:schedule_system,代码行数:101,代码来源:Configuration.cpp


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