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


C++ Student类代码示例

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


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

示例1: main

int main(void)
{
   Student stu;
    stu.setName("answer");
    stu.setGender("男");
    stu.initScore();
    stu.study(10);
    cout<<stu.getName()<<" "<<stu.getGender()<<" "<<stu.getScore()<<endl;
    
    return 0;
}
开发者ID:AnSwErYWJ,项目名称:cpp,代码行数:11,代码来源:kage.cpp

示例2: entermenu

// Enter Information Menu.
char entermenu(istream& is) {

	system("cls");
	Person person;
	Student student;

	int ec;

	do {
		cout << endl;
		cout << setw(25) << left << "   Enter Information" << endl;
		cout << setw(25) << setfill('-') << "" << endl;

		cout << setw(25) << setfill(' ') << "1. Create Personal Profile" << endl;
		cout << setw(25) << "2. Add Student Information" << endl;
		cout << setw(25) << "3. Add Work Information" << endl;
		cout << setw(25) << "4. Back to Main menu" << endl << endl;

		cout << setw(25) << "Please select an option: ";
        
		cin >> ec;
		cin.ignore();

		switch(ec) {
		case 1:
			person.menu();
			break;
		case 2:
			// Add Student Information.
			student.addStudentInfo();
			break;
		case 3:
			// Add Work Information.
			break;
		case 4:
			break;
		}

	} while (ec != 4);


	return ec;

}
开发者ID:lkisac,项目名称:My-Programs,代码行数:45,代码来源:main.cpp

示例3: main

int main(){
    Student s1("张飞",28);
    s1.Print();
    /**
     * 这种方式的话,s1里的m_pszName和s2中的m_pszName是一样的,都是地址值,当s1离开作用域的时候
     * 会调用析构函数,当s2离开作用的时候也会调用析构函数,这样的话,就会double
     * free,释放了两次
     */
    Student s2(s1);
    s2.Print();
#if 0
    Student s3 = s2;
    s3.Print();
    Student *ps = new Student(s3);
    ps->Print();
    delete ps;
#endif
    return 0;
}
开发者ID:nannanwuhui,项目名称:C-,代码行数:19,代码来源:cpcons.cpp

示例4: updateExpComboBox

void Expectations::updateExpComboBox()
{
    expSelect_->clear();

    Student* student = UTManager::instance().student();
    if(!student)
        return;

    const QList<Expectation*> &exp = student->exp();
    for(int i = 0; i < exp.size(); i++)
    {
        expSelect_->addItem(exp.at(i)->name());
    }

    expSelect_->insertItem(0,"Nouvelle prévision");
    expSelect_->setCurrentIndex(0);

    createExpPanel();
}
开发者ID:cmercier,项目名称:UTProfiler,代码行数:19,代码来源:expectations.cpp

示例5: Student

void Database::Search(string sType, string sValue){
                                                                               // simple but horribly inefficent search function
  bool foundValue = false;
  int size = Database::iTotalStudents;

  for(int i = 0; i < size; i++){

    Student newStudent = Student();
    newStudent = Database::getStudentOffArray(i);

    if(sType == "last"){
      if(newStudent.getLastName() == sValue){
	foundValue = true;
	cout <<"\nFound a match for " << sValue << endl;
	cout << newStudent;
      }//end if

    } else if (sType == "first"){

      if(newStudent.getFirstName() == sValue){
	foundValue = true;
	cout <<"\nFound a match for " << sValue << endl;
	cout << newStudent;
      }//end if

    } else if (sType == "city"){

      Address newAddress = Address();
      newAddress = newStudent.getAddress();

      if(newAddress.getCity() == sValue){
	foundValue = true;
	cout <<"\nFound a match for " << sValue << endl;
	cout << newStudent;
      }//end if
    }//end if
  }//end for

    if(!foundValue){
      cout << "\n*****************************String not found." << endl;
    }//end if

}//end method
开发者ID:nathan-boyd,项目名称:schoolCode,代码行数:43,代码来源:Database.cpp

示例6: main

int main()
{
	Person * p = new Student;
	Student * s = new Student;
	Student * gs = new GradStudent;
	Person * ps = new GradStudent;
	
	p->aboutMe();
	s->aboutMe();
	gs->aboutMe();
	ps->aboutMe();
	
	delete p;
	delete s;
	delete gs;
	delete ps;
	
	return 0;
}
开发者ID:vietlq,项目名称:cpp,代码行数:19,代码来源:dynamic-binding.cpp

示例7: print_list

void 
print_list()
{
	int i;
	const LinkedList &sList = master_student_list();  //local reference to student list.
	const LinkedList &cList = master_course_list();	  //local reference to course list.
	Student *studentPtr;  // local pointer to student object
	Course *coursePtr;	  // local pointer to course object
	
	if (sList.size() <= 0)  // Attempts to acces an empty list are avoided.
		cerr << "\n*** No Students in the List ***\n" << endl;
		
	if (sList.size() > 0)
	{
		cout << "\nSTUDENTS CURRENTLY IN THE DATABASE" << endl;
		// Print out the student objects.
		for (i = 0; i < sList.size(); i++)
		{
			// Get a student object from the list
			studentPtr = (Student*)sList[i]; // uses operator overloading for '[]'
	
			// Now print the student using the print behaviour of the student object.
			studentPtr->print();
		}
	}

	if (cList.size() <= 0)  // Attempts to acces an empty list are avoided.
		cerr << "\n*** No Courses in the List ***" << endl;

	if (cList.size() > 0)
	{
		cout << "ENROLLMENT FOR ALL COURSES IN THE DATABASE\n" << endl;
		// Print out the course objects.
		for (i = 0; i < cList.size(); i++)
		{
			// Get a course object from the list
			coursePtr = (Course*)cList[i];

			// Now print the course using the print behaviour of the course object.
			coursePtr->print();
		}
	}
}
开发者ID:malachig,项目名称:archive,代码行数:43,代码来源:main.cpp

示例8: main

void main()
{  int i;
   string w;
	cout << "Lesson1:  Encapsulation - Scope Resolution"<< endl ;
	a.initialize ();
	b.initialize ();

	cout <<"Enter Student name : " ; getline(cin,w);	
	strcpy(a.name,w.c_str());
	if (a.name[0]=='\0')  // if the name is empty
		return;
	printf("Enter # of credits : " );	cin >>a.credits ; // scanf("%d", &a.credits );

	a.add_new_course("CS 3397",2);
	a.add_new_course("CS 2410",3);
	a.display_info();
	for (i=0 ; i<8 && a.crs[i].ID[0]; i++ )
		a.crs[i].display_info();
}
开发者ID:Dem77,项目名称:C-Plus-Plus,代码行数:19,代码来源:Scope+Resolution.cpp

示例9: main

int main()
{
  ofstream data;
  data.open("Student.dat",ios::out|ios::binary);

  char name[20], id[10], department[20], address[20];
  char ans;

  do
  {
    cout << "Enter Student information" << endl;
    cout << "Name: ";
    cin >> name;
    cout << "Id: " ;
    cin >> id;
    cout << "Department: " ;
    cin >> department;
    cout << "Address: " ;
    cin >> address;

    Student newStudent(name,id,department,address);

    data.write(reinterpret_cast<char *>(&newStudent),sizeof(newStudent));
    cout << "Do you want to continue adding student data y/n";
    cin >> ans;
  }
  while(ans == 'y');
  data.close();
 
  ifstream info;
  info.open("Student.dat",ios::in|ios::binary);
  while(!info.eof()) 
  {
    Student newStudent;
    info.read(reinterpret_cast<char *>(&newStudent),sizeof(newStudent));
    if (info)
      newStudent.display();
  }
  info.close();
  
  return SUCCESS;
}
开发者ID:shubhajeet,项目名称:cpp,代码行数:42,代码来源:student.cpp

示例10: callBackGetAllStudents

int StudentDao::callBackGetAllStudents(void *, int elementCount, char **element, char **colName)
{
	Student student;
	student.setUid(element[0] ? element[0] : "NULL");
	student.setName(element[1] ? element[1] : "NULL");
	student.setSex(element[2] ? element[2] : "NULL");
	student.setCredit(element[3] ? element[3] : "NULL");
	student.setGrade(element[4] ? element[4] : "NULL");
	student.setMajor(element[5] ? element[5] : "NULL");
	student.setDepartment(element[6] ? element[6] : "NULL");
	students.push_back(student);
	return 0;
}
开发者ID:Sinton,项目名称:StudentCourseSystem,代码行数:13,代码来源:StudentDao.cpp

示例11: Getstudentgrade

float Course::Getstudentgrade(Student& s){
	int i;
	Node* p;p=studentlist;
	for(i=0;i<studentnum;i++){
		if(strcmp(s.Getname(),p->Studentname)==0)
			return p->grade;
		p=p->next;
	}
	cout<<"can't find student"<<endl;
	return 0;
}
开发者ID:aa8391093,项目名称:LixuecongOnlineRepository,代码行数:11,代码来源:Course.cpp

示例12: main

int main() {
    int age, standard;
    string first_name, last_name;

    cin >> age >> first_name >> last_name >> standard;

    Student st;
    st.set_age(age);
    st.set_standard(standard);
    st.set_first_name(first_name);
    st.set_last_name(last_name);

    cout << st.get_age() << "\n";
    cout << st.get_last_name() << ", " << st.get_first_name() << "\n";
    cout << st.get_standard() << "\n";
    cout << "\n";
    cout << st.to_string();

    return 0;
}
开发者ID:assem-ch,项目名称:academic_projects,代码行数:20,代码来源:class.cpp

示例13: Setgrade

void Course::Setgrade(Student& s,float a){
	int i;
	Node* p;p=studentlist;
	for(i=0;i<studentnum;i++){
		if(strcmp(s.Getname(),p->Studentname)==0){
			p->grade=a;
		cout<<"scessfully"<<endl;
		exit(0);
		}
	}
}
开发者ID:aa8391093,项目名称:LixuecongOnlineRepository,代码行数:11,代码来源:Course.cpp

示例14: average

int ClassMember::average(QMap<QDateTime, Session *> *sessions)
{
    long double score = 0.0;
    long double maxscore = 0.0;
    for (int i = 0; i < ms_sessions.count(); ++i) {
        Session *session = sessions->value(ms_sessions.at(i).session, NULL);
        if (session == NULL)
            continue;
        if (ms_sessions.at(i).member_num < 0 || ms_sessions.at(i).member_num >= session->numStudents())
            continue;
        Student *student = session->student(ms_sessions.at(i).member_num);
        score += student->score();
        maxscore += student->maximumScore();
    }
    if (score == 0.0)
        return 0;
    if (maxscore == 0.0)
        return 100;
    return (int)(100.0 * score / maxscore);
}
开发者ID:gz818,项目名称:itest,代码行数:20,代码来源:class.cpp

示例15: dispStudentRecord

int dispStudentRecord(){		//Display all Student Records
	Student obj;
	int v=0;
	fstream fl(FLBSTUD, ios::in|ios::binary);
	if(!fl){					//If file does not exist
		cout<<"Empty Records !\n";
		return 0;
	}
	while(!fl.eof()){
		fl.read((char*)&obj, sizeof(obj));
		if(fl.eof())
			break;
		v=1;
		obj.printDetails();
		RULE('-');
	}
	fl.close();
	if(!v)
		cout<<"Empty Records !\n";
	return v;
}
开发者ID:iamkunal,项目名称:School-Management-Sys,代码行数:21,代码来源:main.cpp


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