Homework/Database-Practicum/Student.cpp
//Check if there is a Student with the same FN
Check if there is a Student with the same FN
Check if there is a Student with the same FN
bool Student::checkStudent(ifstream& db) const {
    int fn=-1;
    db.clear();
    db.seekg(0,ios::beg);
    while(!db.eof()){
        db>>fn;
        db.ignore(256,'\n');
        if(this->fn==fn) return  false;
    }
    if(grade<2 || grade>6) return  false;
    return true;
}
bool Student :: checkStudent ( ifstream & db ) const { int fn = -1 ; db . clear ( ) ; db . seekg ( 0 , ios :: beg ) ; while ( ! db . eof ( ) ) { db >> fn ; db . ignore ( 256 , ' \n ' ) ; if ( this -> fn == fn ) return false ; } if ( grade < 2 || grade > 6 ) return false ; return true ; }
Check if there is a Student with the same FN
Check if there is a Student with the same FN
//Check the grade range