RCMS.cpp
/*************************DELETING A RECORD*************************/
/*
To delete a record, the teacher first enters the roll number of a student.
Once this is done, the list of records is searched for a student with a matching roll number

If this student is found, then they are taken out of the list

If this student is not found, then the record was not found, and the teacher returns to the Teacher() function
*/
DELETING A RECORD
To delete a record, the teacher first enters the roll number of a student.
Once this is done, the list of records is searched for a student with a matching roll number

If this student is found, then they are taken out of the list

If this student is not found, then the record was not found, and the teacher returns to the Teacher() function
DELETING A RECORD To delete a record the teacher first enters the roll number of a student . Once this is done the list of records is searched for a student with a matching roll number If this student is found then they are taken out of the list If this student is not found then the record was not found and the teacher returns to the Teacher () function
void del() {
    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 << "\n\n\n\n\n\n\n\n\n\n\n\t\t";
        cout << "ENTER THE ROLL NUMBER OF THE STUDENT: ";
        cin >> n;
        system("cls");
        while (f1.read((char *) &s, sizeof(s))) {
            if (n != s.roll_number) {
                f2.write((char *) &s, sizeof(s));
                flag = 1;
            }
        }
        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";
        } else {
            cout << "\n\n\n\n\n\n\n\n\n\n\n\t\t";
            cout << "THE RECORD WAS DELETED SUCCESSFULLY";
            cout << "\n\n\n\n\n\n\n\n";
        }
    }
    f1.close();
    f2.close();
    remove("Record.dat");
    rename("Temp.dat", "Record.dat");
}
void del ( ) { 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 << " \n \n \n \n \n \n \n \n \n \n \n \t \t " ; cout << " " ; cin >> n ; system ( " " ) ; while ( f1 . read ( ( char * ) & s , sizeof ( s ) ) ) { if ( n != s . roll_number ) { f2 . write ( ( char * ) & s , sizeof ( s ) ) ; flag = 1 ; } } 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 " ; } else { cout << " \n \n \n \n \n \n \n \n \n \n \n \t \t " ; cout << " " ; cout << " \n \n \n \n \n \n \n \n " ; } } f1 . close ( ) ; f2 . close ( ) ; remove ( " " ) ; rename ( " " , " " ) ; }
DELETING A RECORD
To delete a record, the teacher first enters the roll number of a student.
DELETING A RECORD To delete a record the teacher first enters the roll number of a student .