-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstudent_data.cpp
More file actions
37 lines (37 loc) · 1.04 KB
/
student_data.cpp
File metadata and controls
37 lines (37 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include"main.hpp"
vector<student>::iterator data::get_student(string s){
int high = student_list.size()-1;
int low = 0;
int mid;
while(high >= low){
mid = (high+low)/2;
string name = student_list[mid].get_name();
if(name == s) return student_list.begin()+mid;
else if(name > s) high = mid-1;
else low = mid+1;
}
return student_list.end();
}
data::data(){
ifstream in;
in.open("database.txt", ios::app);
in.seekg(0);
string fname,lname,enroll,grade;
int yos;
date a(0,0,0), b(0,0,0);
long long phone;
string address;
string bg;
while(!in.eof()){
in >> fname >> lname >> enroll >> grade >> yos;
in >> a.day >> a.month >> a.year >> b.day >> b.month >> b.year;
in >> phone;
in >> bg;
in >> address;//getline(in, address);
student_list.push_back(student(fname,lname,enroll, grade, yos, a, b, stud_details(phone, bg, address)));
}
}
vector<student> data::get_student_list(){
auto x = student_list;
return x;
}