RCMS.cpp
/************************MODIFYING A RECORD************************/
/*
To modify a record, the teacher needs to first enter the roll number associated with
the record of choice.

After enterring a roll number, the list of records is searched to find a matching roll number,
and then that student's record is grabbed. 

After grabbing the record, the enter() function within the definition of the Student class is called,
and the changes are made by simulating a new student being enterred into the database

Once this is done, the old student is removed from the record, and the new temporary student takes the
place of the deleted student

If that roll number is not found, the teacher goes back to the Teacher() function.
*/
MODIFYING A RECORD
To modify a record, the teacher needs to first enter the roll number associated with
the record of choice.

After enterring a roll number, the list of records is searched to find a matching roll number,
and then that student's record is grabbed.

After grabbing the record, the enter() function within the definition of the Student class is called,
and the changes are made by simulating a new student being enterred into the database

Once this is done, the old student is removed from the record, and the new temporary student takes the
place of the deleted student

If that roll number is not found, the teacher goes back to the Teacher() function.
MODIFYING A RECORD To modify a record the teacher needs to first enter the roll number associated with the record of choice . After enterring a roll number the list of records is searched to find a matching roll number and then that student ' s record is grabbed . After grabbing the record the enter () function within the definition of the Student class is called and the changes are made by simulating a new student being enterred into the database Once this is done the old student is removed from the record and the new temporary student takes the place of the deleted student If that roll number is not found the teacher goes back to the Teacher () function .
void modify() {
    STUDENT s;
    ifstream f1("Record.dat");
    ofstream f2("Temp.dat", ios::binary);
    int n, flag = 0;
    if (!f1) {
        cout << "\n\n\n\n\n\n\n\n\n\n\n\t\t\t\tFILE NOT FOUND!";
        cout << "\n\n\n\n\n\n\n\n";
    } else {
        cout << "ENTER THE ROLL NUMBER OF THE STUDENT: ";
        cin >> n;
        while (f1.read((char *) &s, sizeof(s))) {
            if (n == s.roll_number) {
                cout << "ENTER THE MODIFIED DETAILS OF THE STUDENT";
                s.enter();
                f2.write((char *) &s, sizeof(s));
                flag = 1;
                break;
            } else {
                f2.write((char *) &s, sizeof(s));
            }
        }
        if (flag == 0) {
            cout << "\n\n\n\n\n\n\n\n\n\n\n\t\t\t\tRECORD NOT FOUND!";
            cout << "\n\n\n\n\n\n\n\n";
        }
    }
    f1.close();
    f2.close();
    remove("Record.dat");
    rename("Temp.dat", "Record.dat");
}
void modify ( ) { STUDENT s ; ifstream f1 ( " " ) ; ofstream f2 ( " " , ios :: binary ) ; int n , flag = 0 ; if ( ! f1 ) { cout << " \n \n \n \n \n \n \n \n \n \n \n \t \t \t \t " ; cout << " \n \n \n \n \n \n \n \n " ; } else { cout << " " ; cin >> n ; while ( f1 . read ( ( char * ) & s , sizeof ( s ) ) ) { if ( n == s . roll_number ) { cout << " " ; s . enter ( ) ; f2 . write ( ( char * ) & s , sizeof ( s ) ) ; flag = 1 ; break ; } else { f2 . write ( ( char * ) & s , sizeof ( s ) ) ; } } if ( flag == 0 ) { cout << " \n \n \n \n \n \n \n \n \n \n \n \t \t \t \t " ; cout << " \n \n \n \n \n \n \n \n " ; } } f1 . close ( ) ; f2 . close ( ) ; remove ( " " ) ; rename ( " " , " " ) ; }
MODIFYING A RECORD
To modify a record, the teacher needs to first enter the roll number associated with
the record of choice.
MODIFYING A RECORD To modify a record the teacher needs to first enter the roll number associated with the record of choice .
//        cout << "\n\n\n\n\n\n\n\n\n\n\n\t\t";
