Beispiel #1
0
int main()
{
   std::ofstream ofs("exam2.hddm");
   hddm_x::ostream ostr(ofs);
   hddm_x::HDDM xrec;

   // ostr.setCompression(hddm_x::k_z_compression);

   for (int n=0; n<1000000; ++n) {
      hddm_x::StudentList student = xrec.addStudents();
      student().name("Humphrey Gaston");
      hddm_x::EnrolledList enrolled = student().addEnrolleds();
      enrolled().year(2005);
      enrolled().semester(2);
      hddm_x::CourseList course = enrolled().addCourses(3);
      course(0).credits(3);
      course(0).title("Beginning Russian");
      course(0).addResults();
      course(0).result().grade("A-");
      course(0).result().pass(true);
      course(1).credits(1);
      course(1).title("Bohemian Poetry");
      course(1).addResults();
      course(1).result().grade("C");
      course(1).result().pass(1);
      course(2).credits(4);
      course(2).title("Developmental Psychology");
      course(2).addResults();
      course(2).result().grade("B+");
      course(2).result().pass(true);
      ostr << xrec;
      xrec.clear();
   }
   ofs.close();
   exit(0);

   // try reading it back in from the output file just written
   std::ifstream ifs("exam2.hddm");
   hddm_x::istream istr(ifs);
   int count=0;
   while (ifs.good()) {
      istr >> xrec;
      if (count/100000*100000 == count) {
         std::cout << "event " << count << std::endl;
         report(xrec);
      }
      ++count;
   }
   std::cout << "finished after " << count << " events read." << std::endl;
   return 0;
}
Beispiel #2
0
int main(int argc, char **argv) {
	std::deque<student> student_deque;
	for (int i = 0; i < 3; ++i) {
		student_deque.push_back(student());
	}
	for (int i = 0; i < 3; ++i) {
		student_deque.push_front(student());
	}
//	for (std::vector<student>::iterator i = student_deque.begin(); i != student_deque.end(); ++i) {
	for (std::deque<student>::iterator i = student_deque.begin(); i != student_deque.end(); ++i) {
		std::cout << *i << " ";
	}
	std::cout << std::endl;
	return 0;
}
//READIN
//Function called on start to read in data from storage file.Receives linklist pointer from main.
// Passes data and the linklist pointer to function to add new student in 
//appropriate position
void readIn(std::list<student>& list){
  ifstream studentFile;
  string line;
  string item;
  string fnameIn;
  string lnameIn;
  string birthdayIn;
  string genderIn;
  string idIn;
  string statusIn;
  string gpaIn;
  //Open the storage file 
  studentFile.open("students.txt",ios::in);
  if (studentFile.is_open()){
    while(!studentFile.eof()){
      if(studentFile>>fnameIn){
      studentFile >> lnameIn >> birthdayIn >> genderIn >> idIn >> statusIn >> gpaIn;
      //Change gender froms string to char, if to integer (for insertion order) and gpa to float. 
      student newStudent= student(fnameIn, lnameIn, birthdayIn,*genderIn.c_str(), atoi(idIn.c_str()) , statusIn , atof(gpaIn.c_str()));
      addStudent_STL(list,newStudent);
      }
    }
      studentFile.close();
      }
  //If file was not opened
  else cout<< "Error.Unable to open storage file.";
Beispiel #4
0
/* this function menu for sudent*/
void student(){
	char ch;
	printf("\n");
	printf("----------------1.SEARCH-------------------------------\n");
	printf("----------------2.SHOW BOOK RECORD BRANCH WISE---------\n");
	printf("----------------3.CHANGE PASSWORD------------------------\n");
	printf("----------------4.MAINMENU--------------------------------\n");
	scanf(" %c",&ch);
	switch(ch){
		case '1':
			search();
			break;
		case '2':
			show();
			break;
		case '3':
			changepass();
			break;
		case '4':
			mainmenu();
			break;
		default :
			printf("---------invalid input----------\n");
			student();
			break;

	}
}
Student Student::CreateFromInput()
{
	int id, creditHours;
	string name, address, date;

	cout << "Create student data from input" << endl;

	cout << "id : ";
	cin >> id;

	cout << "name : ";
	cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n'); 
	getline(cin, name);

	cout << "address : ";
	getline(cin, address);

	cout << "first enrollment date : ";
	getline(cin, date);

	cout << "completed credit hour : ";
	cin >> creditHours;

	Student student(id, name, address, date, creditHours);
	return student;
}
Beispiel #6
0
BOOL CStudentEditWnd::Create( int schoolYearID, int x, int y, CMDIFrameWnd* parent ) {
	CStudent student( schoolYearID );

	BOOL retval = CMDIChildWnd::Create(
		NULL,
		"New Student",
		WS_CHILD | WS_OVERLAPPEDWINDOW,
		CRect( x, y, 610+x, 445+y ),
		parent,
		NULL
	);

	if ( retval ) {
		retval = dialog.Create( IDD_STUDENTEDIT, this );
	}

	dialog.ShowStudent( student, schoolYearID );

	CRect client;
	GetClientRect( client );
	if ( retval ) {
		dialog.SetWindowPos( &wndTop, 0, 0, client.Width(), client.Height(), SWP_SHOWWINDOW );
	}

	return retval;
}
Beispiel #7
0
int main() {
	Person person(19, "tzz");
	person.Introduce();
	Student student(19,"tzz",7);
	student.Introduce(); 
	Worker worker(19,"tzz");
	worker.Introduce();  
	return 0;
}
Beispiel #8
0
Student LoginManager::getStudentDetails(QString roll)
{
    if(db.open())
    {
        QString queryString = QString("SELECT * FROM students WHERE RollNo = '").append(roll.toUpper()).append("'");
        QSqlQuery query = db.exec(queryString);
        query.next();
        Student student(query.value(0).toString(), query.value(1).toString(), query.value(2).toString(), query.value(3).toString(), query.value(4).toString(), query.value(7).toInt());
        db.close();
        return student;
    }
}
Beispiel #9
0
bool to_student( const std::string& line, student& s )
{
    std::istringstream stm(line) ;

    if( std::getline( stm, s.first_name, delimiter ) &&
        std::getline( stm, s.last_name, delimiter ) &&
        std::getline( stm, s.credits, delimiter ) &&
        std::getline( stm, s.gpa, delimiter ) &&
        std::getline( stm, s.first_date, delimiter ) &&
        std::getline( stm, s.second_date ) ) return true ;

    s = student() ;
    return false ;
}
int main(void)
{
    int i, j, a[5][3];

    for (i = 0; i < 5; i++)
        for (j = 0; j < 3; j++)
            scanf("%d", &a[i][j]);
    student(a[0]);
    puts("");
    subject(a[0]);
    puts("");

    return 0;
}
Beispiel #11
0
void LogIn::LogInSetter(string newId, string newPassword) {
	fstream students;
	string name, password, email, id;
	students.open("students.txt", ios::in);

	while (!students.eof()) {
		students >> name >> password >> email >> id;
		if (newId == id && newPassword == password){
			cout << "Successfully Signed In As a Student! " << endl;
			Student student(name, id);
			student.studentMenu();
		}
		else if (students.eof() && newId == id && newPassword == password){
			cout << "Invalid Credentials!! " << endl; // TODO consider a better implementation
		}
	}
}
int main()
{
	float a[100][5],b[100],c[5];
	int n,i;
	printf("请输入学生个数:\n");
	scanf("%d",&n);
    printf("请输入每个学生的5门课成绩:\n");
	for(i=0;i<n;i++)
	{
		scanf("%f%f%f%f%f",&a[i][0],&a[i][1],&a[i][2],&a[i][3],&a[i][4]);
	}
    student(a,b,n);
	lesson(a,c,n);
	max(a,n);
	variance(a,b,n);
	return 0;
}
Beispiel #13
0
student student::ntod(int n)
{
	int y=1,m=1,d,rest=n,lp;
	while(1)
	{
		if(leap(y))
		{
			if(rest<=366)
				break;
			else
				rest-=366;
		}
		else
		{
			if(rest<=365)
				break;
			else
				rest-=365;
		}
		y++;
	}
	y--;
	lp=leap(y);
	while(1)
	{
		if(lp)
		{
			if(rest>day_tab[1][m-1])
				rest-=day_tab[1][m-1];
			else
				break;
		}
		else
		{
			if(rest>day_tab[0][m-1])
				rest-=day_tab[0][m-1];
			else
				break;
		}
		m++;
	}
	d=rest;
	return student(y,m,d);
}
Beispiel #14
0
int main() {
	group g;
	g.students.push_back(student(5));
	std::cout << g.avgrate() << std::endl;

	std::vector<int> array = { 0, 1, 2, 3 };
	array[2] = 109000;
	array.push_back(1000);
	array.erase(array.begin() + 2);
	for (int i = 0; i < array.size(); i++){
		std::cout << *(array.begin() + i) << "   ";
	}
	std::cout << std::endl;

	for (std::vector<int>::iterator i = array.begin(); i < array.end(); i++){
		std::cout << *i << "   ";
	}
	std::cout << std::endl;

	for each (auto a in array){
		std::cout << a << "   ";
	}
Beispiel #15
0
int main()
{
	Date compGradDate(12, 6, 2017);

	MathStudent numberStudent("Jeremy Lin", 12456717, 25, "617-823-8925",
							  'M', "Freshman", 3.0, "42 Harwood Avenue",
							  "Harwich", "MA.", 82653);

	CS1Cstudent compStudent("James Davis", 98035769, 25, "661-877-8825",
							'M', "Sophomore", 3.5, 120, true, compGradDate);

	Student		student("Douglas Adams", 42424242, 42, "666-987-0042",
						'M', "Senior", 4.2);

	cout << endl << endl;
	PrintAll(numberStudent);
	cout << endl << endl;
	PrintAll(compStudent);
	cout << endl << endl;
	PrintAll(student);
	cout << endl << endl;

	return 0;
}
Beispiel #16
0
/*this function take id and pass */
void login(){
	struct data{
		char id[10];	
		char pass[16];
	};
	strc st;
	struct data c;
	char ch;
	char m[10] ,n[16],x,pa[10];
	int d=0,a=0;	
	printf("WELCOME STUDENT\n");
	FILE *fp;
	FILE *fs;
	fs=fopen("sho.txt","ab+");
	fp=fopen("stud","rb+");
	printf("/**************ADMIN ID=123   PASS= 00 ******************/\n");
	printf("ENTER THE ID 5 DIGIT FOR LOGIN \n");
	scanf("%s", m);
	printf("ENTER 5 DIGIT PASS\n");
	pass(n);
	rewind(fp);
	while(a==0){
	while(fread(&c,sizeof(c), 1, fp)==1){
	
		if((strcmp(c.id,m)==0) && (strcmp(c.pass,n)==0)){
			fwrite(c.id,sizeof(c.id),1,fs);	
			printf("SUCCESFULLY LOGIN\n");
			d=1; a=1;
			break;
		}
		else {
			a=0;
			}
		}
			if(a==0){
			printf("1.RE ENTER\n ");
			printf("2.MAINMENU\n");
			scanf(" %c",&x);		
			switch(x){
				case '1':
					m[0]='\0';n[0]='\0';
					printf("ENTER THE ID \n");
					scanf("%s", m);
					printf("ENTER  PASS\n");
					pass(n);
					rewind(fp);
					
					break;
				case '2':
					mainmenu();
				}
		}
	}
	
	if(d){	
		//system("clear");
		printf("----------------1.SEARCH-------------------------------\n");
		printf("----------------2.SHOW BOOK RECORD BRANCH WISE---------\n");
		printf("----------------3.CHANGE PASSWORD------------------------\n");
		printf("----------------4.MAINMENU--------------------------------\n");
		scanf(" %c",&ch);
		switch(ch){
			case '1':
				search();
				break;
			case '2':
				show();
				break;
			case '3':
				changepass();
				break;
			case '4':
				mainmenu();
				break;
			default :
				printf("---------INVALID INPUT----------\n");
				student();
				break;

		}
	}
	fclose(fp);
}