School Billing System In C

A database automatically created to store comprehensive information on ongoing school activities concerning payments and accounts, covering both student and faculty accounts. This system is essential for safeguarding school payment records and accessing them as needed.

This software system or database primarily holds records of students' outstanding fees, the salaries owed to faculty, staff, and non-teaching personnel, the overall payments made by students, any advance payments received, among other details. To organize this system effectively, we will categorize it into three distinct modules or components. The initial module will handle date-related information, the second will manage student data, and the third will oversee faculty and non-teaching staff data. Our objective is to develop a program utilizing switch cases and fundamental features of the "C" programming language.

The module that the School Billing System program in C is segmented into are:

  • date
  • student
  • faculty and non-teaching staff

Here, the component " date " signifies the logging of record entries on a specific date, such as student or faculty record entries. In case new records are added on that date, this component assists in retrieving the details of those records. It captures and retains the date and month of the day when the records are added. The component " student " represents the information regarding students' fees, including fee arrears, advance payments, etc., associated with each student. This component is employed to oversee the record of every student enrolled in the institution. The component " faculty " showcases the specifics of the salary received by each faculty member. It is utilized to supervise the record of each faculty member affiliated with the institution.

The operations that can be performed using School Billing System in C are:

  • check for date
  • add new student record or faculty record
  • update an already existing record
  • search an already existing record
  • delete a record
  • find the salary of a record
  • find the fee of a record

The process of "verifying the date" provides access to the activities carried out on a specific date, such as creating a new student entry, faculty entry, and more. On the other hand, the process of "inserting a new student or faculty entry" enables the addition of a new entry linked to a student, faculty member, or non-teaching staff, thereby expanding the database's record count. Additionally, the process of "modifying an existing entry" allows for adjustments or alterations to be made to current records of students, faculty, or non-teaching staff. This is particularly useful for scenarios like updating a faculty member's salary. As a result, the database executes the necessary updates using this method.

The process of "locating an existing entry" allows you to find a specific student, faculty, or non-teaching staff entry by providing relevant details for a comprehensive display of all associated data. The function "remove an entry" enables you to eliminate a student, faculty, or non-teaching staff entry entirely from the interconnected database. By executing this function, any record can be permanently removed. The "retrieve salary details" function is utilized to fetch the salary information of faculty and non-teaching staff members exclusively, excluding students. The "retrieve fee details" function is employed to determine the total fee amount expected from a particular student and also highlights any pending fees, if applicable.

Let's break down the program into segments, with each segment containing a method explaining one of the operations mentioned earlier, one after the other in order. Once we have identified methods for all the operations specified, we can combine these methods to create a software solution that manages and displays the Student Record System. This approach enhances the accessibility and comprehensibility of our work.

There are multiple approaches that may be incorporated in the implementation of the School Billing System program in C. Let's examine each technique individually before integrating all the necessary components of the program and finalizing the project as a whole.

Methods that are involved in the program:

  • start

The function responsible for commencing user operations is the " start " method. Program execution will commence upon accessing this method.

  • check_date

The function used to retrieve the activities performed on a specific date is called "check_date". For instance, the action of adding a new student entry or faculty information on the specific date of February 20, 2022, is recorded. Therefore, upon inputting the date "20th February 2022", the system will display the activity carried out on that day, such as adding a new student or faculty record, allowing users to review the events that occurred on that particular day.

  • addnewrecord

The function "addnewrecord" facilitates the addition of a new entry associated with either a student, faculty member, or non-teaching staff. This function contributes to the expansion of the database by incorporating additional records.

  • update

The process that enables users to adjust or alter information in the current records of students, faculty, or non-teaching staff is known as the modification function, specifically called "update". For instance, if a faculty member's salary is raised, the user can utilize the update method to change the salary information for that specific faculty member whose salary has been increased.

  • locate_entry

The function used to locate and display specific student, faculty, or non-teaching staff records based on specified details is known as "find_record". For removing a record, you can utilize the function

  • delete_record.

The function "delete_record" is designed to remove a specific record from the database, whether it pertains to a student, faculty member, or non-teaching staff. Executing this function results in the complete deletion of the chosen record from the linked database. To complement this functionality, you can utilize the method

  • findrecordsalary to search for and retrieve salary information associated with a particular record.

The function employed to determine the salary of employees within the faculty and administrative staff, excluding students, is called "findrecordsalary".

  • findrecordfee

The function responsible for determining the overall fee for a specific student, including any outstanding dues, indicating the advance payment made, and any potential reimbursement, is called "findrecordfee".

The program includes various functions essential for the School Billing System in the C programming language. We have previously covered a general understanding of these functions. Now, let's delve deeper into each method's specifics and the corresponding code ensuring they function as intended. These functions serve as the fundamental building blocks of the program, crucial for developing a comprehensive School Billing System using C.

1. add_new_record

Example

// method that is declared 
// to create a new record
// which deals with student 
// data or faculty data
// or non-teaching staff 
// data by scanning the 
// requirements of the 
// record 

void add_new_record(int j)
{
    int differ, cdate, ddate, month = 0;
    float ff;
    char c = 'y';
    // initially declaring the required 
    // variables for the method
    printf("\n\n");
    printf(" YOU CAN ADD A NEW RECORD NOW !!");

    // condition if the given argument
    // is valued with 1
    // i.e. if the value of j
    // is 1, then the data will
    // be belonging to a student
    if(j == 1)
    {
        // iteration is initiated 
        // so that the statements 
        // can be repeated until the
        // condition fails

        while (c == 'Y' || c == 'y')
        {
            // if y is given
            // whether capital or
            // small alphabet " f "
            int a = 1;
            printf("\n");
            // taking the input of
            // name of the student
            printf(" Enter the full name of the student:");
            fflush(stdin);
            scanf("%[^\n]",student.n);

            // taking the input 
            // of the class of the 
            // new student
            printf(" Enter the class: ");
            fflush(stdin);
            scanf("%2d", &student.r);
            printf(" Enter the day and its month ");
            printf("until which the fee is already paid");
            fflush(stdin);
            scanf("%2d %2d", &cdate, &ddate);
            cdate = check_date(cdate, ddate);
            student.dt.m = cdate;
            ff = student.c / 10.0;
            student.f = 1000 * (1 + ff);
            differ =  mm - student.dt.m;
            student.fine = (differ * student.f) * 1 / 100;
            student.due = (differ) * student.f;
            if(differ == 1)
            {
                student.tot = student.f;
                student.fine = 0;
            }
            else
            {
                student.tot = student.fine + student.due;
            }
            fs = fopen(" student "," ab+ "); 
            fwrite(&student , sizeof(student), 1, fs);
            fclose(fs);
       printf("\n\n Will you continue ");
            printf("with the process? Y or N");

            fflush(stdin);
            c = getch();
        }
        getch();
    }
    if (j == 2)
    {
        while(c == 'y'||c == 'Y')
        {
            int a = 1;
            printf("\n\n Enter the name of the ");
            printf("faculty or non-teaching staff");
            fflush(stdin);
            scanf(" %[^\n]", teacher.n);
            printf("\n Enter the faculty ");
            printf("or non-teaching staff id:");
            fflush(stdin);
            scanf(" %d", &teacher.id);
            printf("\n Enter the number of classes ");
            printf("or shifts in a month: ");
            scanf(" %d", &teacher.no);
            fflush(stdin);
            printf("\n Enter the day and month until ");
            printf("which the salary is paid:")
            scanf(" %d %d", &teacher.dt.m, &teacher.dt.d);
            cdate = check_date(cdate, ddate);
            teacher.dt.m = cdate;
            teacher.sal = teacher.no * 500;
            teacher.adv = (teacher.dt.m - mm - 1) * teacher.sal;
            if (teacher.adv < 0) 
            {
                teacher.adv = 0;
            }
            teacher.tot = teacher.sal;
            ft = fopen("teacher","ab+");
            fwrite(&teacher, sizeof(teacher), 1, ft);
            fclose(ft);
            printf("\n\n Will you continue ");
            printf("with the process? Y or N");
            fflush(stdin);
            c = getch();
        }
        fflush(stdin);
        printf("\n\n");
        system("pause");
    }
}

An explanation for the aforementioned code snippet that demonstrates a function:

The function "addnewrecord" is implemented to insert a fresh entry that may pertain to a student, faculty member, or non-teaching staff. The record's classification and type may align with any predefined categories within the educational institution. Therefore, the primary objective of this function is to create a new entry and subsequently integrate it into the database. Consequently, the addition of a new record is exclusively facilitated through this function.

Initially, the essential variables are defined with the appropriate data types essential for the program. Following the variable declaration, the execution of the method is initiated by selecting the option "Yes or No" from the checkbox. When the user decides to commence the method or input a new record, they must press "y" to indicate their readiness for the method to commence its operation.

At the start of the primary function in the software, the user is prompted to specify if they wish to input a fresh student record or a new faculty record. If the choice is a student record, the user is required to input 1. In the case of opting for a faculty or non-teaching staff record, the user needs to select and input 2. Subsequently, based on the input value stored in the variable "j," the function determines the appropriate course of action.

When the input value is 1, the system prompts the user to provide details about the student, requiring information like their name, class, amount paid, outstanding fees, and more. Should the student have unpaid fees, the system can display this information accordingly. Additionally, this function performs various operations beyond just recording data. These operations are integrated within the method to ensure accurate tracking of the student's fee balance and related details.

If the user opts for a value of 2 for the variable " j ", similar iterations and procedures will be executed for either the faculty or non-teaching staff records. Therefore, the input received for the variable " j " determines the data entry for both the student and staff modules. This approach allows for the showcasing of salary specifics for teaching and non-teaching staff, enabling users to check due or advance salary amounts conveniently.

It is not calculated immediately, but instead, the process redirects to another function that handles various operations (excluding addstudent, which will be covered later). This approach allows for the execution of a wide range of operations on student information, faculty information, and non-teaching staff details using the "addnew_record" function.

2. find_record

Example

// method that is declared 
// to search record
// which deals with student 
// data or faculty data
// or non-teaching staff 
// data by scanning the 
// requirements of the 
// record
void find_record(int j)
{
    // consider the required
    // variables and declare them
    char sname[50],tname[50];
    int a = 1, choice;
    char c = 'y';
    // check the condition for which 
    // the records must be searched
    // condition verification regarding
    // the student details
    // or faculty details

    // if the student data is 
    // supposed to be searched
    if (j == 1)
    {
        // while the user replies
        // yes to continue
        while(c == 'Y'||c == 'y')
        {
            int a = 1;
            
            printf("\n\n\t\t How do you want to search?");
            printf("\n\n\t\t 1. Want to search by name:");
            printf("\n\n\t\t 2. Want to search by class:");
            printf("\n\n\t\t 3. Want to search by roll number:");
            printf("\n\n\t\t 4. Exit");
            printf("\n\n\t\t Enter your desired choice: ");
            fflush(stdin);
            scanf("%d", &choice);
            // if the user wants to
            // search the record by name
            // of the student
            if (choice == 1)
            {
                a = 1;
                printf("\n\n Enter the name of the ");
                printf("student that you want to find: ");
                fflush(stdin);
                // scanning the name of the student
                scanf("%[^\n]", sname);
                fs=fopen(" student "," rb ");
                while(fread(&student, sizeof(student), 1, fs) == 1)
                {
                    if (strcmpi(sname, student.n) == 0)
                    {
                        a = 0;
                        printf("\n Name of the student is %s", student.n);
                        printf("\n Class of the student is %d", student.c);
                        printf("\n The roll number of the student is %d", student.r);
                        printf("\n Monthly fee of the student is %.2f",student.f);
                        printf("\n Fee paid previously is %2d",student.dt.m);
                        printf("\n Due left is %.2f",student.due);
                        printf("\n Fine to be paid is %.2f",student.fine);
                        printf("\n Total is %.2f\n\n", student.tot);
                    }
                }
                if (a == 1)
                    printf("\n\n The record that you ");
                    printf("are searching for is not found.\n\n");
                system("pause");
                fflush(stdin);
                fclose(fs);
            }
            // if the user wants to 
            // search the record by using
            // the class of the student
            else if (choice == 2)
            {
                int cl;
                a = 1;
                printf("\n\n Enter the class of the student ");
                printf("in order to find his or her details: ");
                fflush(stdin);
                cl = clscanf();
                fs = fopen(" student "," rb ");
                while(fread(&student, sizeof(student), 1, fs) == 1)
                {
                    if (student.c == cl)
                    {
                        a  = 0;
                        printf("\n Name of the student is %s", student.n);
                        printf("\n Class of the student is %d", student.c);
                        printf("\n The roll number of the student is %d", student.r);
                        printf("\n Monthly fee of the student is %.2f",student.f);
                        printf("\n Fee paid previously is %2d",student.dt.m);
                        printf("\n Due left is %.2f",student.due);
                        printf("\n Fine to be paid is %.2f",student.fine);
                        printf("\n Total is %.2f",student.tot);
                    }
                }
                if (a == 1)
                    printf("\n\n The record that you are ");
                    printf("searching for is not found.\n\n");
                system("pause");
                fflush(stdin);
                fclose(fs);
            }
            // if the user wants to 
            // search the record by using
            // the roll number of the student
            else if (choice == 3)
            {
                int roll;
                a = 1;
                printf("\n\n Enter the roll number of the ");
                printf("student in order to find the details: ");
                fflush(stdin);
                roll = clscanf();
                fs = fopen(" student "," rb ");
                while(fread(&student, sizeof(student), 1, fs) == 1)
                {
                    if (strcmpi(roll, student.r) == 0)
                    {
                        a = 0;
                        printf("\n Name of the student is %s", student.n);
                        printf("\n Class of the student is %d", student.c);
                        printf("\n The roll number of the student is %d", student.r);
                        printf("\n Monthly fee of the student is %.2f",student.f);
                        printf("\n Fee paid previously is %2d",student.dt.m);
                        printf("\n Due left is %.2f",student.due);
                        printf("\n Fine to be paid is %.2f",student.fine);
                        printf("\nTotal is %.2f",student.tot);
                    }
                }
                if (a == 1)
                    printf("\n\n The record that you are ");
                    printf("searching for is not found.\n\n")
                system("pause");
                fflush(stdin);
                fclose(fs);
            }
            // if the user desires 
            // to exit 
            else if(choice == 4)
            {
                exiting();
            }
            else
            {
                printf("\n\n\n\t\t The given input is invalid.\n\n\t\t");
                system("pause");
                find_record(1);
            }
            printf("\n\n If you want to continue, then press y or Y");
            fflush(stdin);
            c = getch();
        }
        getch();
    }

    // if the faculty data or 
    // non-teaching staff data is 
    // supposed to be searched
    if (j == 2)
    {
        while(c  == 'Y'||c == 'y')
        {
            int a=1;
            printf("\n\n Enter the name of the ");
            printf("faculty or non-teaching staff ");
            printf("to find their details: ");
            fflush(stdin);
            scanf("%[^\n]", tname);
            ft=fopen(" teacher "," rb ");
            while(fread(&teacher, sizeof(teacher), 1, ft) == 1)
            {
                // checking the condition
                // whether the given input matches
                // any of the data or record
                // by checking with the corresponding 
                // name of the faculty 
                // or non-teaching staff
                if (strcmp(tname, teacher.n) == 0)
                {
                    a = 0;
                    printf("\n The name of the teacher is %s", teacher.n);
                    printf("\n The id of the teacher is %d", teacher.id);
                    printf("\n Last month when the salary is paid is %d", teacher.dt.m);
                    printf("\n The salary that is paid per month is %.2f", teacher.sal);
                    printf("\n The advance salary paid is %.2f",teacher.adv);
                }
            }
            if (a == 1)
                printf("\n\n The record that you are searching ");
                printf("for is not found.")
            printf("\n\n");
            system("pause");
            fflush(stdin);
            fclose(ft);
            printf("\n\n If you still want to continue ");
            printf("with the process, then press Y or y");
            fflush(stdin);
            c=getch();
        }
        getch();
    }

}

An elucidation for the aforementioned code snippet that demonstrates a function:

The function "retrieve_data" serves the purpose of locating information pertaining to an existing entry, which may pertain to a student, faculty member, or non-academic staff. The record in question can be classified under any of the specified categories within the institution. Therefore, the primary objective of this function is to access the specifics of the entry. By employing this function, it becomes possible to retrieve relevant details by referencing the name of the student, faculty, or staff member. Consequently, this function proves to be highly beneficial in scenarios involving miscommunication or necessitating verification.

Initially, the essential variables are defined with their appropriate data types as necessary for the program. Following the variable declaration, the functionality of the "find_record" method is set to commence and prompts for user confirmation through the checkbox options "Yes or No". Once the user opts to initiate the method or search for an existing record, they are required to press "y" to indicate their readiness for the method to execute.

At the onset of the primary function in the software, the user is prompted to specify whether they wish to look up a student's information or that of a faculty member, which also covers non-teaching personnel. Opting to search for a student record requires inputting '1', while selecting to search for faculty or non-teaching staff details necessitates entering '2'. Based on the user-input variable "j", the function determines the course of action to take.

When the value provided is 1, the system prompts the user to input a specific detail related to the student's record, such as their name or class. The user is required to input the requested detail accordingly. Within this function, the input specifically requested is the student's name. Various other details can also be input. If the student's fee has been settled partially and there remains an outstanding balance, this information can also be retrieved and displayed using the prescribed statements within this function. While it is possible to access and execute other related functions to extract additional details, it is recommended to define and handle these operations within the same function for clarity and efficiency. These functions are intricately interconnected within this method to ensure accurate tracking of the student's financial status, including any pending fee amounts.

If the user selects a value of 2 for the variable " j ", similar iterations and processes will occur for both the faculty record and the non-teaching staff record. Therefore, the input provided for the variable " j " determines the input for both the student module and the staff module. This approach allows for the display of salary information for teaching staff as well as non-teaching staff, providing insight into due or advance salary amounts.

All the declarations specified in this function are computed directly without invoking any other functions contained in the code. The sole type of function call within the function is recursion, which involves calling the function within itself. By utilizing the "find_record" method, it is possible to retrieve all types of information pertaining to student records, faculty records, and non-teaching staff records.

3. update

Example

// method that is declared 
// to update an already existing
// record which deals with 
// student data or faculty data
// or non-teaching staff 
// data by scanning the 
// requirements of the 
// record
void update(int j)
{
    // consider the required
    // variables in order to perform 
    // the function or method

    // name of the record
    // either student or faculty
    // or non-teaching staff
    char name[50];
    int a = 1;

    int choice, cl, roll;
    char c = 'y';

    // if the user wants to
    // modify the details of 
    // the student
    // then he or she must
    // choose j as 1
    if ( j == 1 )
    {
        // a loop that repeats 
        // until the process is 
        // completed, and the base
        // condition becomes false
        while( c == 'y' || c == 'Y' )
        {
            system("cls");
            printf(" You can modify the record now!! ");
            printf("\n\n\t\t Choose the type of ");
            printf("modification that you want to perform.");
            printf("\n\n\t\t 1. Modify by the name");
            printf(" of the student ");
            printf("\n\n\t\t 2. Modify by the name ");
            printf("and class of the student ");
            printf("\n\n\t\t 3. Modify by the name, ");
            printf("roll number and class of the student ");
            printf("\n\n\t\t 4. Exit ");
            printf("\n\n\t\t Out of the above options, ");
            printf("enter one choice number: ");
            fflush(stdin);
            scanf(" %d", &choice);
            // if the user chooses 
            // to modify the details
            // using name of the student
            if ( choice == 1 )
            {
                int a = 0;
                printf("\n\n Enter the name of the student");
                printf(" that you want to modify: ");
                fflush(stdin);
                // scanning the name of 
                // the student
                scanf(" %[^\n]",name);
                fs=fopen("student","rb+");
                while( fread(&student, sizeof(student), 1, fs) == 1 )
                {
                    a=1;
                    if ( strcmpi(name, student.n) == 0 )
                    {
                        a=0;
                        printf("\n Enter the new name of the student");
                        printf(" that you want to modify: ");
                        fflush(stdin);
                        // scanning the new name
                        // of the student
                        scanf(" %[^\n]",student.n);
                        printf("\n Enter the new class of the student");
                        printf(" that you want to modify: ");
                        fflush(stdin);
                        // scanning and modifying the
                        // new class of the student
                        student.c = clscanf();
                        printf("\n Enter the new roll number ");
                        printf("of the student that you want to modify: ");
                        fflush(stdin);
                        // scanning the new roll  
                        // number of the student 
                        scanf("%d", &student.r);
                        fseek(fs,-sizeof(student), SEEK_CUR);
                        fwrite(&student, sizeof(student), 1, fs);
                        fclose(fs);
                    }
                }
                if ( a == 1 )
                    printf("\n\n The record that you ");
                    printf("are searching for is not ");
                    printf("found !!");
                else
                    printf("\n\n The chosen records are ");
                    printf("successfully modified !!");
                printf("\n\n");
                system("pause");
            }
            // if the user chooses 
            // to modify the details
            // using name and class 
            // of the student
            else if ( choice == 2 )
            {
                int a = 0;
                printf("\n\n Enter the name of the student ");
                printf("that you want to modify: ");
                fflush(stdin);
                // scanning the name of the
                // student that you want to
                // modify
                scanf(" %[^\n]",name);
                printf("\n\n Enter the class of the student ");
                printf("that you want to modify: ");
                fflush(stdin);
                // scanning the class of the 
                // student that you want to
                // modify
                cl=clscanf();
                fs=fopen(" student "," rb+ ");
                while( fread(&student, sizeof(student), 1, fs) == 1 )
                {
                    a=1;
                    if ( strcmpi(name, student.n) == 0 && cl == student.c )
                    {
                        a=0;
                        printf("\n Enter the new name of the student ");
                        printf("that you want to modify: ");
                        fflush(stdin);
                        // scanning the new name of the 
                        // student that you want to
                        // modify
                        scanf("%[^\n]", student.n);
                        printf("\n Enter the new class of the student ");
                        printf("that you want to modify: ");
                        fflush(stdin);
                        // scanning the new class of the 
                        // student that you want to
                        // modify
                        student.c = clscanf();
                        printf("\n Enter the new roll number of ");
                        printf("the student that you want to modify: ");
                        fflush(stdin);
                        // scanning the new roll number 
                        // of the student that you want 
                        // to modify
                        scanf("%d", &student.r);
                        fseek(fs,-sizeof(student), SEEK_CUR);
                        fwrite(&student, sizeof(student), 1, fs);
                        fclose(fs);
                    }
                }
                if ( a == 1 )
                    printf("\n\n The record that you ");
                    printf("are searching for is not ");
                    printf("found !!");
                else
                    printf("\n\n The chosen records are ");
                    printf("successfully modified !!");
                printf("\n\n");
                system("pause");
            }
            // if the user chooses 
            // to modify the details
            // using name, class and 
            // roll number of the student
            else if ( choice == 3 )
            {
                int a = 0;
                printf("\n\n Enter the name of the student ");
                printf("that you want to modify: ");
                fflush(stdin);
                // scanning the name of the
                // student that you want to
                // modify
                scanf(" %[^\n]",name);
                printf("\n\n Enter the class of the student ");
                printf("that you want to modify: ");
                fflush(stdin);
                // scanning the class of the 
                // student that you want to
                // modify
                cl = clscanf();
                printf("\n\n Enter the roll number of the ");
                printf("student that you want to modify: ");
                fflush(stdin);
                // scanning the roll number of the 
                // student that you want to
                // modify
                scanf("%d", &roll);
                fs=fopen(" student "," rb+ ");
                while( fread(&student, sizeof(student), 1, fs) == 1 )
                {
                    a = 1;
                    if (strcmpi(name, student.n) == 0 && cl == student.c && roll == student.r)
                    {
                        a = 0;
                        printf("\n Enter the new name of the student ");
                        printf("that you want to modify: ");
                        fflush(stdin);
                        // scanning the new name of the 
                        // student that you want to
                        // modify
                        scanf(" %[^\n]",student.n);
                        printf("\n Enter the new class of the student ");
                        printf("that you want to modify: ");
                        fflush(stdin);
                        // scanning the new class of the 
                        // student that you want to
                        // modify
                        student.c = clscanf();
                        printf("\n Enter the new roll number of ");
                        printf("the student that you want to modify: ");
                        fflush(stdin);
                        // scanning the new roll number 
                        // of the student that you want 
                        // to modify
                        scanf("%d", &student.r);
                        fseek(fs,-sizeof(student), SEEK_CUR);
                        fwrite(&student, sizeof(student), 1, fs);
                        fclose(fs);
                    }
                }
                if (a == 1)
                    printf("\n\n The record that you ");
                    printf("are searching for is not ");
                    printf("found !!");
                else
                    printf("\n\n The chosen records are ");
                    printf("successfully modified !!");
                printf("\n\n");
                system("pause");
            }
            // if the user chooses to exit
            // from the portal
            else if (choice == 4)
                exit(0);

            // if an invalid entry
            // is given
            else
            {
                printf("\n\n\n\t\t The given input for choice ");
                printf("is not valid\n\n\t\t");
                system("pause");
                update(1);
            }

            printf("\n\n If you still wish to continue with ");
            printf("the above process the press y or Y");
            fflush(stdin);
            c=getch();
        }
        getch();
    }
    // if the user wants to
    // modify the details of 
    // the faculty or 
    // non-teaching staff,
    // then he or she must
    // choose j as 2
    if ( j == 2 )
    {
        while( c == 'y' || c == 'Y' )
        {
            int a=1;
            printf(" Enter the name of the faculty");
            printf(" or the non-teaching staff");
            printf(" that you want to modify: ");
            fflush(stdin);
            // scanning the name of the
            // faculty or the 
            // non-teaching staff
            scanf("%[^\n]", name);
            ft = fopen(" teacher "," rb+ ");
            while( fread(&teacher, sizeof(teacher), 1, ft) == 1)
            {
                if ( strcmpi(name, teacher.n) == 0)
                {
                    a=0;
                    printf("\n Enter the new name of ");
                    printf("the faculty or non-teaching");
                    printf(" staff that you want to modify: ");
                    fflush(stdin);
                    // scanning the new name of the faculty
                    // or the non-teaching staff
                    scanf("%[^\n]", teacher.n);
                    printf("\n Enter the new id of the ");
                    printf("faculty or the non-teaching");
                    printf(" faculty that you want to modify: ");
                    fflush(stdin);
                    // scanning the new id of the faculty
                    // or the non-teaching staff
                    scanf("%d", &teacher.id);
                    fseek(ft, -sizeof(teacher), SEEK_CUR);
                    fwrite(&teacher, sizeof(teacher), 1, ft);
                    fclose(ft);
                }
            }

            if (a == 1)
                printf("\n\n The record that you ");
                    printf("are searching for is not ");
                    printf("found !!");
                else
                    printf("\n\n The chosen records are ");
                    printf("successfully modified !!");
                printf("\n\n");
            system("pause");
            fflush(stdin);

            printf("\n\n If you still wish to continue with ");
            printf("the above process the press y or Y");
            fflush(stdin);
            c = getch();
        }
        getch();
    }
}

An elucidation for the aforementioned code snippet that demonstrates a procedure:

The function "update" is employed to modify the information of a record that already exists, whether it pertains to a student, faculty member, or non-teaching staff. The record's type and category can be any of the predefined types within the School. Therefore, the primary objective of this function is to locate and adjust the particulars of the specified record.

By employing this technique, we have the ability to modify the information stored within the system. The specific details pertaining to a record can be retrieved based on the name of the student, faculty member, or non-teaching staff. This approach proves to be highly beneficial in scenarios where miscommunications occur, and there is a need for verification and subsequent adjustments.

At first, the necessary variables are defined with the appropriate data types essential for the program. Following the variable declaration, the execution of the function "update" is set to commence, prompting for validation through the checkbox option "Yes or No". Upon opting to initiate the function or locate an existing record, the user must input "y" to indicate their readiness for the function to operate.

At the onset of the primary function within the software, the user is prompted to indicate whether they intend to look up information related to a student's record or that of a faculty member, which also encompasses non-teaching personnel. If the choice is to search for a student record, the user should input 1. Alternatively, if they wish to access details regarding a faculty or non-teaching staff record, they should select and input 2. Based on the input value stored in the variable "j" provided by the user, the function determines the appropriate course of action.

When the input value is 1, the program prompts the user to enter specific details from the student's record. This could include the student's name, the name and roll number, or the name, class, and roll number. The user needs to provide input for the requested details, such as name or class, based on the choice variable set within the program. Selecting this option involves entering a corresponding number within the program.

In this function, we prompt the user to input the student's name. The user can choose to input any specific detail. Upon entering the student's name, the system locates the corresponding record and enables the user to make modifications to the details. Subsequently, the updated details can be viewed using the specified statements within the function. Additional functions can be invoked and connected to retrieve details, but the information should be outlined within the same function.

If the user selects the value of the variable " j " as 2, it will trigger identical iterations and processes for the faculty record as well as the non-teaching staff record. Consequently, the input provided for the variable " j " determines the data entry for both the student module and the staff module. This technique enables the adjustment and presentation of salary specifics for both teaching and non-teaching staff. Additionally, the identification number of faculty or non-teaching staff members can also be altered using this approach.

If the information entered by the user - be it a student, faculty member, or non-teaching staff - does not align with the data stored in the database, the function will proceed to the else block. Within this block, a message is displayed stating "The record you are looking for cannot be found." This notification alerts the user that the input provided may be incorrect or invalid. This process remains consistent across all types of records - student, faculty, or non-teaching staff - until the correct record is located.

All the declarations specified in this function are computed directly without invoking any additional functions contained within the code. This enables the manipulation of various aspects pertaining to student data, faculty data, and non-teaching staff data by utilizing the "update" function.

4. delete_record

Example

// method that is declared 
// to delete an already existing
// record, which deals with 
// student data or faculty data
// or non-teaching staff 
// data by scanning any of the 
// details of the 
// record
void delete_record(int j)
{
    system("cls");
    
    printf("You have entered the deletion block !!");
    // declare and define the 
    // required variables
    // for performing deletion
    // operation

    // name of the record
    // either student or faculty
    // or non-teaching staff
    FILE *temp, *t1;
    int a = 1;
    char name[50], c = 'y';

    // if the user wants to
    // delete the details of 
    // the student
    // then he or she must
    // choose j as 1
    if ( j == 1 )
    {
        // a loop that repeats 
        // until the process is 
        // completed, and the base
        // condition becomes false
        while(c == 'y' || c == 'Y' )
        {
            int a = 1;
            printf("\n\n Enter the name of student ");
            printf("whose record you want to delete: ");
            fflush(stdin);

            // scanning the name of the
            // student
            scanf(" %[^\n]", name);

            // opening the file in read mode
            f = fopen("student", "rb");

            // consider a temp variable
            // which is set to open the file
            // in write mode
            temp = fopen(" tempfile ", " wb ");

            // when the name of the student 
            // entered is equal to one of the 
            // names that are present within
            // the records
            while ( fread(&student, sizeof(student), 1, f) == 1 )
            {
                // deleting the student's record
                // if the details are matched with
                // the found record
                if ( strcmp(student.n, name) == 0 )
                {
                    a = 0;
                    continue;
                }
                else
                {
                    fwrite(&student, sizeof(student), 1,  temp);
                }
            }
            // if any record is not
            // yet deleted
            if ( a == 1 )
            {
                printf("\n\n The record that you are");
                printf(" searching for is not found !!");
            }
                
            else
            {
                printf("\n\n The deletion of record ");
                printf(" is completed successfully !!");
            }
                
            printf("\n\n");
            system("pause");
            fflush(stdin);

            fclose(fs);
            fclose(temp);
            system("del student");

            // the data that is supposed to
            // be deleted is initially stored
            // in a temporary variable " temp "
            // which is further lead to deletion
            system("ren tempfile, student");
       //renaming temp to student
            printf("\n\n If you still wish to continue with the process, press y or Y");
            fflush(stdin);
            c = getch();
        }
        getch();
    }
    // if the user wants to
    // delete the details of 
    // the faculty or
    // non-teaching staff, 
    // then he or she must
    // choose j as 2
    if ( j == 2 )
    {
        a = 1;
        char namet[50];
        while( c == 'y' || c == 'Y' )
        {
            printf("\n\n Enter the name of the ");
            printf("faculty or non-teaching ");
            printf("staff that you want to delete: ");
            fflush(stdin);
            // scanning the name of 
            // the faculty or non-teaching
            // staff
            scanf("%[^\n]", namet);

            ft=fopen(" teacher ", " rb ");
            t1=fopen(" tempfile1 ", " wb ");
            while ( fread(&teacher, sizeof(teacher), 1, ft) == 1 )
            {
                if ( strcmp(teacher.n, namet) == 0 )
                {
                    a = 0;
                    continue;
                }
                else
                {
                    fwrite(&teacher, sizeof(teacher), 1, t1);
                }
            }

            if ( a == 1 )
            {
                printf("\n\n The record that you are");
                printf(" searching for is not found !! ");
            }
                
            else
            {
                printf("\n\n The deletion of the record");
                printf(" is completed successfully !! ");
            }
                
            printf("\n\n");
            system("pause");
            fflush(stdin);

            fclose(ft);
            fclose(t1);
            system("del teacher");
            system("ren tempfile1, teacher");
            printf("\n\n If you still wish to continue with the process, press y or Y");
            fflush(stdin);
            c = getch();
        }
        getch();
    }
}

An elucidation for the preceding code snippet that demonstrates a function:

The function " delete_record " is designed to remove all information pertaining to an existing record, regardless of whether it pertains to a student, faculty member, or non-teaching staff. The specific type and category of the record can vary among the predefined types within the school system. Therefore, the primary objective of this function is to locate and eliminate the data associated with the specified record.

By employing this approach, it is possible to erase the entry while retrieving the specific details based on the student's, faculty's, or non-teaching staff's name. This technique proves valuable when a student departs from the institution or when staff members resign, allowing for the removal of their information from the database.

Initially, the necessary variables are defined with the appropriate data types essential for the program. Following the variable declaration, the execution of the function " delete_record " can commence, prompting for user confirmation through the selection of " Yes or No " from a checkbox. Upon opting to initiate the function or search for an existing record, users are required to press " y " to indicate their readiness for the method to execute.

At the start of the primary function in the software, the user is prompted to specify whether they intend to look up a student's information or that of a faculty member, which encompasses non-teaching personnel as well. Opting for a search related to a student record requires the input of '1'. Alternatively, selecting to explore faculty or non-teaching staff details necessitates entering '2'. Based on the user-input variable "j", the function determines the appropriate path to proceed with the operation.

When the input value equals 1, the program prompts the user to input the student's name. The user is required to provide the name when prompted. Once the user enters the student's name, the program proceeds with its intended functionality. Similarly, the program also requests input for the student's name. Any specific detail can be requested as input. Upon entering the student's name, the system searches for the corresponding record with that name and enables the user to delete the relevant record as needed. Additionally, the program can display the deleted record using the specified statements within the method.

If the user opts for a value of 2 for the variable " j ", the identical iterations and functions will be executed with either the faculty record or the non-teaching staff record. Consequently, the input provided for the variable " j " determines the inclusion in both the student module and the staff module. This procedure facilitates the deletion of records pertaining to both teaching and non-teaching staff members.

If the input provided by the user, whether it be a student, faculty, or non-teaching staff, does not correspond with the information stored in the database, the function will return the alternative section. This section includes the message "The record you are seeking is not located," indicating to the user that the input may be incorrect or invalid. This process is consistent across all types of records - student, faculty, or non-teaching staff - until the correct record is identified.

5. find_record_salary

Example

// method that is declared 
// to find the salary
// of a faculty record or
// non-teaching staff
// record, which deals with 
// faculty data or 
// non-teaching staff 
// data by scanning the 
// requirements of the 
// record

void find_record_salary(int mm)
{
    system("cls");
    
    // consider the required
    // variables in order to perform 
    // the function or method

    
    FILE *f, *t;
    int a = 1, day;

    // name of the record
    // either faculty record
    // or non-teaching staff
    // record
    char name[50], c = 'y';
    int month, differ, id;

    // a loop that repeats 
    // until the process is 
    // completed, and the base
    // condition becomes false
    while(c == 'y'|| c == 'Y')
    {
        int a = 1;
        fflush(stdin);
        printf("\n\n Enter the name ");
        printf("of the faulty or ");
        printf("non-teaching staff record: ");

        // scanning the name 
        // of the faculty record
        // or the non-teaching
        // staff record
        scanf(" %[^\n]", name);
        printf("\n\n Enter the id of the ");
        printf("faculty record or non-teaching");
        printf(" staff record: ");

        // scanning the id of the
        // faculty record or
        // non-teaching staff record
        scanf(" %d",&id);

        f = fopen(" teacher "," rb+ ");
        t=fopen(" te "," wb+ ");

        // through the below base condition
        // within the while loop,
        // the file is successfully opened
        while(fread(&teacher, sizeof(teacher), 1, f) == 1)
        {
            // the name that is entered through
            // the input is verified and compared
            // with the existing names within the 
            // database of records
            if(strcmp(teacher.n, name) == 0 )
            {
                float lsal;
                a = 0;
                printf("\n\n Enter the month in which ");
                printf("the last salary is paid")
                fflush(stdin);

                // scanning the month in which the
                // last salary is paid
                scanf("%d", &month);

                // the month is assigned with
                // the method calling, i.e.,
                // check_date method 
                // with two parameters, i.e., month 
                // and day
                month = check_date(month, day);

                // the advance that is already
                // given to the staff
                // is being calculated here
                teacher.adv = (month - mm - 1) * teacher.sal;
                if (teacher.adv < 0)
                {
                    teacher.adv = 0;
                }

                // the month where last
                // salary is paid and no.
                // of months the salary must 
                // be paid
                lsal = mm - teacher.dt.m;

                if(lsal < 0)
                {
                    lsal = 0;
                }
                teacher.tot = teacher.adv + teacher.sal * (1 + lsal);
                if(month == teacher.dt.m) 
                {
                    teacher.tot = 0;
                }
                printf("\n The leftover monthly salary that is");
                printf(" supposed to be paid is %.2f",lsal);

                printf("\n The total salary is %.2f",teacher.tot);
                printf("\n The advance salary given is %.2f",teacher.adv);
                teacher.dt.m = month;
                fwrite(&teacher, sizeof(teacher), 1, t);
                fclose(f);
                fclose(t);

                if (a == 1)
                {
                    printf("\n\n The record that you are");
                    printf(" searching for is not found !!");
                }
                else
                {
                    printf("\n\n The salary details ");
                    printf("have been accurately printed !!");
                }
                    
                printf("\n\n");
                system("pause");
                fflush(stdin);
                system("del teacher");
                system("ren te, teacher");
            }
        }
        printf("\n\n If you still wish to continue, press y or Y");
        fflush(stdin);
        c = getch();
    }
    getch();
}

An elucidation for the aforementioned code which demonstrates a function:

The function "searchsalaryrecord" is utilized to locate the salary information of either faculty members or non-teaching staff based on certain details provided. Its purpose is to validate the salary amount that has been paid and determine the remaining balance that needs to be disbursed. This function can handle various types and categories of records within the School system, ensuring accurate salary account details retrieval for any specified record.

By employing this approach, we can ascertain the salary status of a record, determine if the full salary has been disbursed, check for any remaining salary from the previous month, and identify if faculty or non-teaching staff have received advance payments. This method enables users to access comprehensive details associated with a specific record based on their name, ID, or a combination of both. Therefore, in situations where payment-related concerns emerge, this method proves to be invaluable, ensuring that all pertinent data is accurately stored within the database.

At the start of the program, the essential variables are defined with the appropriate data types required for the program. Following the variable declaration, the function "findrecordsalary" is set to commence and prompts for user confirmation through the checkbox options "Yes or No". Once the user opts to initiate the function or look up an existing record, they need to press "y" to indicate their readiness for the method to execute.

At the beginning of the main function of the program or a method, the user is not asked to give input on whether he or she wants to search for a student record or a faculty record, as the salary aspect is only related to a faculty record or non-teaching staff record. There can be confusion between a faculty record and a non-teaching staff record, but in order to overcome such type of confusions, both the records are considered to be taken as a single category naming staff which includes faculty records and non-teaching staff records.

Therefore, the individual must opt to search for a personnel record without any additional decision-making steps. This particular approach distinguishes itself from previously defined methods. Upon accessing the method or function body, the individual is prompted to input both the name and ID of the academic or administrative staff. Subsequently, once the user inputs the name and ID of the staff member, the program initiates its actual process. The system compares the user-provided name and ID with the existing records in the database. Upon identifying a match, the operational process commences.

When the name or identification number matches with the input data for faculty or non-teaching staff, the system will compute various salary details. This includes the amount of advance salary already disbursed, the remaining balance of the salary yet to be paid, the last month the salary was issued, and so forth. In cases where the advance payment to the faculty or non-teaching staff is below 0 and this criteria is met, it typically indicates that no advance payment had been made before.

So, the initial amount variable is set to the value " 0 ", and likewise, if the salary paid at the end of the month matches that of the preceding month, then the remaining salary will also be set to " 0 ". Correspondingly, the loops and computations will be executed for the non-academic staff entries as well. This approach enables the presentation of salary specifics for both teaching staff (faculty) and non-teaching staff.

If the information provided by the faculty or non-teaching staff does not match the records in the database, the function will return the else statement, "The record you are looking for cannot be found." This message indicates to the user that the entered information may be incorrect or invalid. This process remains consistent for both faculty and non-teaching staff records until the correct record is located.

6. find_record_fee

Example

// method that is declared 
// to find the fee details
// of a student record
// which deals with 
// the student data 
// by scanning the 
// requirements of the 
// record

void find_record_fee(int mm)
{
    // consider the required
    // variables in order to perform 
    // the function or method
    
    FILE *f, *t;
    int a = 0;

    // name of the student
    // record
    char name[50], c = 'y';
    int class, roll, month, differ;

    // a loop that repeats 
    // until the process is 
    // completed, and the base
    // condition becomes false
    while(c == 'y' || c == 'Y')
    {
        int a = 1, day = 0;
        fflush(stdin);
        printf("\n\n Enter the name of ");
        printf("the student that you want ");
        printf("to find the fee details: ");

        // scanning the name 
        // of the student record
        scanf("%[^\n]",name);         
        printf("\n\n Enter the class of the ");
        printf("student that you want to find");
        printf(" the fee details: ");
        fflush(stdin);

        // scanning the class
        // of the student record
        class = clscanf();

        printf("\n\n Enter the roll number ");
        printf("of the student that you want to find");
        printf(" the fee details: ");
        fflush(stdin);

        // scanning the roll number 
        // of the student record
        scanf("%d", &roll);

        // opening the student file
        // in read mode
        f = fopen("student","rb+");

        // write mode
        t = fopen("te","wb");

        // through the below base condition
        // within the while loop,
        // the file is successfully opened
        while(fread(&student, sizeof(student), 1, f) == 1)
        {
            // the name, class and roll number
            // that is entered through
            // the input is verified and compared
            // with the existing names within the 
            // database of records
            if(strcmp(student.n, name) == 0 && class == student.c && roll == student.r)
            {
                a = 0;
                printf("\n\n Enter the last month upto ");
                printf("which the fee is paid: ")
                fflush(stdin);

                // scanning the month
                // in which the last 
                // fee is paid
                scanf("%d", &month);

                month = check_date(month, day);
                differ = mm - student.dt.m;
                student.fine = (differ * student.f) * 0.01;
                student.due = (differ) * student.f;
                if (student.fine < 0)
                {
                    student.fine = 0;
                } 
                if (student.due < 0)
                {
                    student.due = 0;
                } 
                if (student.tot < 0)
                {
                    student.tot=0;
                } 
                student.tot = student.fine + student.due + student.adv;
                printf("\n The fine that");
                printf(" the student is supposed to pay is");
                printf(" %.2f", student.fine);
                printf("\n The left due that");
                printf(" the student is supposed to pay is");
                printf(" %.2f", student.due);
                printf("\n The total amount that");
                printf(" the student is supposed to pay is");
                printf(" %.2f", student.tot);
                printf("\n The advance amount that");
                printf(" the student has already paid is");
                printf(" %.2f", student.adv);
                student.dt.m = month;
                student.tot = 0;
                student.fine = 0;
                student.due = 0;
                fwrite(&student, sizeof(student), 1, t);
            }
        }
        if (a == 1)
        {
            printf("\n\n The record that you are");
            printf("searching for is not found !!");
        }
            
        printf("\n\n");
        system("pause");
        fflush(stdin);

        fclose(f);
        fclose(t);
        system("del student");
        system("ren te, student");
        printf("\n\n If you still wish to continue the process, press y or Y");
        fflush(stdin);
        c = getch();
    }
    getch();
}

An elucidation for the aforementioned code snippet that demonstrates a function:

The function " retrievefeedetails " is employed to locate the fee information within student records based on specific details provided. This process aims to validate the payment status and determine any outstanding fees for the student. The record's classification and category can vary among the predefined types within the School system. Therefore, the primary objective of this function is to extract the fee account particulars for a designated student record.

By employing this approach, we are able to ascertain the fee status of the student's record, including the verification of complete fee payments, identification of any outstanding fees from previous months, determination of past dues, and confirmation of any advance fee payments made by the student. This method allows for comprehensive access to all these specific details by utilizing the student's name, class, and ID within the record. Therefore, this methodology proves highly beneficial in addressing any concerns related to fee transactions, ensuring that all relevant data is accurately stored in the database.

At the outset of the program, essential variables are defined with the appropriate data types necessary for its operation. Following the variable declarations, the execution of the function "findrecordfee" is set to commence and prompts for user confirmation via the selection between "Yes" or "No" in a checkbox. When the user opts to initiate the function or search for an existing record, they should press "y" to indicate their readiness for the method to start executing.

At the onset of the primary function within the program or a procedure, the user is not prompted to indicate a preference for searching a student record or a faculty record, given that the fee component exclusively pertains to student records. Therefore, the selection is limited to searching for a student record without any optional decision-making. This represents a significant distinction in this particular method compared to previously defined methods. The method bears resemblance to the "findrecordsalary" method in terms of execution criteria, albeit with differing operations.

Upon accessing the method or function body, the individual is prompted to input the student's name, class, and roll number. Once the user provides this information, the program execution commences. The entered name, class, and roll number are validated against the existing database records. Upon discovering a match, the operational process initiates.

When all the provided user inputs align with the complete details, the system will compute the fee particulars. This computation encompasses the advance fee amount, the remaining fee balance, the last month of fee payment, among others. In the scenario where the student's advance payment is below 0 and this criterion is met, it typically indicates that no advance payment had been made previously.

So, the initial payment variable is set to "0", and likewise, if the final month's paid fee matches the previous month, then the remaining outstanding fee will also be set to "0". This process continues with subsequent iterations and actions. By following these steps, it is possible to view the fee information of student records.

If the student's input does not match any records in the database, the function will return the else block containing the message, "The record that you are searching for is not found." This message prompts the user to recognize that the entered information may be incorrect or invalid. This process applies consistently for both faculty and non-teaching staff records until the correct record is located.

7. check_date

Example

// method that is declared 
// to check the date, 
// making sure that it
// has no mistakes
// and the sequence of 
// actions that are 
// taken on that particular 
// day regarding a student 
// record or a faculty 
// record or a non-teaching 
// staff record

int check_date(int month, int date)
{
    // consider the required
    // variables in order to perform 
    // the function or method
    int mon, day;

    // the condition defines that the month
    // less than or equal to 12 and greater
    // than or equal to 1
    // Similarly, the date is greater than
    // or equal to 1 and less than 
    // or equal to 31

    // if any one of the above 
    // conditions are failed
    // the method enters the if the condition
    // and prints that the entered
    // date is invalid
    if (month > 12 || month < 1 || date < 1 || date > 31)
    {
        MessageBox(0," The entered date is invalid !! \nEnter the date again", " Error!",0);

        fflush(stdin);
        scanf("%d %d", &mon, &day);
        mon = check_date(mon, day);
    }
    else
        return (month);
}

An elucidation for the previously mentioned program that demonstrates a procedure:

The function " check_date " serves the purpose of validating the user input to determine if it represents a valid date. When an invalid date is detected, the user is promptly notified and prompted to provide a new input. The validation process involves assessing the month and date components independently. Should the month value fall outside the range of 1 to 12, an invalid status is triggered. Similarly, if the date value is below 1 or exceeds 31, an invalid status is set. Any other scenarios result in the program displaying the respective month. The primary objective of this function is to ensure the accuracy of the input date through thorough validation checks.

8. clscanf

Example

// method that is declared
// for the internal use of the
// program in order to scan a 
// few parameters of the records

int clscanf()
{

    // declare the required 
    // variables
    int month, mon;
    fflush(stdin);

    // scanning the month 
    scanf("%d", &month);
    if (month > 12 || month < 1)
    {

        MessageBox(0,"The class entered is Invalid !! \nEnter the Class: ","Error!!",0);
        fflush(stdin);
        mon = clscanf();
    }
    else
        return month;
}

An elucidation for the preceding code snippet that demonstrates a technique:

The function " clscanf " is defined to read the class whenever scanning is needed across the program through its invocation. The function is structured in such a manner to ensure the integrity of the program at the points where it is utilized. Similar to other functions, variables are initialized at the start of the program and later used during class scanning and condition evaluation. Once the base condition is validated, the execution enters the " if body " where scanning occurs. In cases where the base condition is not met, the program flow transitions to the " else body ", resulting in the return of the variable " month ".

9. exiting

Example

// method that is declared
// to exit from the execution
// of the program
// as soon as an object or 
// variable within the program
// calls or access it

void exiting()
{
    // declaring the required
    // variables
    int i;

    system("color 0c");
    printf("\n\n\t\t You have chosen to");
    printf(" exit from the program\n\n");
    printf("\n\n\t\t Thank you !!\n\n");

    system("pause");
    system("cls");

    printf("\n\n\t\t\t Exiting from the program\n\n");

    // loop declaration
    // in order to 
    // perform wait operation
    for(i = 1; i <= 80; i++)
    {
        Sleep(50);
        printf("*");
    }
    exit(0);
}

An elucidation for the aforementioned code snippet that demonstrates a particular technique:

The function " exit " is utilized to terminate program execution immediately upon invocation. An integer variable " i " is initialized at the start of the program and serves as a consistent variable throughout the code. When " exit(0) " is triggered, it indicates the user's intention to halt the program's execution at that specific moment. Upon calling this function, the program will cease running and return to the initial terminal unless the user restarts the program. Besides program termination, there is also a mechanism for pausing execution known as sleep. The act of sleeping involves pausing program execution for a specified period, after which the program resumes its operation.

10. start

Example

// method that is declared
// to enable the program
// and create an interface
// to start the process of
// the program provides all
// the available choices

void start()
{
    // consider the required
    // variables in order to perform 
    // the function or method
    int i, j;

    system("cls");
    // enter the value of j
    // so that the type of the
    // record can be known by the
    // system in order to execute
    printf("\n\t\t Enter the type of the account from the following options !! ");
    printf("\n\t\t 1. Student account");
    printf("\n\t\t 2. Faculty and non-teaching staff account");
    printf("\n\t\t 3. Exit ");
    printf("\n\t\t Enter the option: ");
    fflush(stdin);

    // scanning the value of j
    scanf("%d", &j);

    // introducing a switch
    // case in which all the above cases
    // can be accessed and displayed
    switch (j)
    {
        // if the entered value
        // of j is 1
        case 1:
        {
            system("cls");
            printf("\n\t\t Enter the choice from the mentioned options below !! ");
            printf("\n\t\t1. Add a record");
            printf("\n\t\t2. Find a record");
            printf("\n\t\t3. Update a record");
            printf("\n\t\t4. Delete a record");
            printf("\n\t\t5. Find fee of a record");
            printf("\n\t\t6. Exit");
            printf("\n\n Enter the choice:  ");
            fflush(stdin);

            // scanning the choice
            scanf("%d", &i);

            // internal switch case
            // declared to access internal 
            // functions of the student record
            switch (i)
            {
                case 1:
                    add_new_record(j);
                    start();
                case 2:
                    find_record(j);
                    start();
                case 3:
                    update(j);
                    start();
                case 4:
                    delete_record(j);
                    start();
                case 5:
                    find_record_fee(mm);
                    start();
                case 6:
                    exiting();

                default :
                {
                    printf("\n\n\t The input entered is Invalid !! ");
                    
                    system("pause");
                    start();
                }
            }
        }
        case 2:
        {

            system("cls");
            printf("\n\t\t Enter the choice from the mentioned options below !! ");
            printf("\n\t\t1. Add a record");
            printf("\n\t\t2. Find a record");
            printf("\n\t\t3. Update a record");
            printf("\n\t\t4. Delete a record");
            printf("\n\t\t5. Find salary of a record");
            printf("\n\t\t6. Exit");
            printf("\n\n Enter the choice:  ");
            fflush(stdin);

            // scanning the choice
            scanf("%d", &i);

            switch (i)
            {
                case 1:
                    add_new_record(j);
                    start();
                case 2:
                    find_record(j);
                    start();
                case 3:
                    update(j);
                    start();
                case 4:
                    delete_record(j);
                case 5:
                    find_record_salary(mm);
                    start();
                case 6:
                    exiting();
                default :
                {
                    printf("\n\n\t The input entered is invalid");
                    
                    system("pause");
                    start();
                }

            }
        }
        case 3:
            exiting();
        default :
        {
            printf("\n\n\t The input entered is Invalid !! ");
            
            system("pause");
            start();
        }
        
    }
}

An elucidation for the aforementioned code snippet that demonstrates a function:

The function " start " is implemented to kickstart the program by gathering input from the user and executing actions accordingly. This method encompasses multiple scenarios that represent varied responses. Following the method declaration, the variables " i " and " j " are assigned specific roles. The variable " i " is responsible for managing the sequence of operations within the inner switch case, while the variable " j " oversees the operations within the outer switch case, which pertains to the account type.

To add further detail, the variable " j " plays a crucial role in determining the type of record being accessed within the system. It distinguishes between student records, faculty records, and non-teaching staff records. When " j " is set to 1, users gain access to student accounts. Setting " j " to 2 grants access to faculty and non-teaching staff accounts. If " j " equals 3, the program halts, allowing the user to exit. This variable remains essential for the program's operation and flow.

The variable " i " facilitates the invocation of functions linked with different account types. For instance, student accounts entail functions such as " addnewrecord ", " findrecordfee ", and "update ", while staff accounts involve functions like "addnewrecord ", " findrecordsalary ", and " find_record ". The variable " i " is crucial for orderly access to these functions. Acting as a sub-variable to the main variable " j ", the value assigned to " i " dictates actions such as adding a new record to the database when set to 1. The nature of the record added is determined by the value of the main variable " j ".

When the value assigned to the variable " j " is 1, access to all functions associated with student accounts becomes available. Inside the switch case for variable " j ", there exists an internal switch case for variable " i " that enhances the functionality related to student accounts. If the value of variable " i " equals 1, utilization of the " addnewrecord " method allows for the addition of a fresh student record into the database.

Similarly, in case the value assigned to the variable " i " is 2, the system can look up an existing entry by utilizing the " find_record " function. This approach enables the utilization of all other functions by initiating the start function. It's worth noting that this process is not limited to student accounts; it extends to staff accounts, encompassing both teaching and non-teaching personnel. By implementing an internal switch case and setting the value of j to 2, modifications and management of staff accounts become feasible. Hence, it is evident that the significance of the " start " function is paramount for the seamless execution of various operations within the program.

The functions or methods essential for building the "School Billing System in C" program are a culmination of all the previously mentioned techniques. Now, we will proceed with constructing the program.

The application showcasing the "Student Record System in C":

Example

// include all the 
// libraries that 
// are required

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<conio.h>

// declare a structure
// for including the date
// along with its representatives
struct date
{
    // d denotes the day
    // m denotes the month
    int d, m;
};
int clscanf();

// declare a structure
// for including the student
// along with their representatives
struct student
{
    struct date dt;
    // f denotes the fee of the student
    // fine denotes the fine that the student
    // must pay
    // tot denotes total fee
    // adv denotes advance fee paid
    // due denotes the due fee
    float f, fine, tot, adv, due;
    char n[50];
    int r, c;
} student, s;

// declare a structure
// for including the faculty 
// and non-teaching staff
// along with their representatives

struct teacher
{
    struct date dt;
    // sal denotes the salary
    // of the staff
    // adv denotes the advance
    // salary paid to the staff
    // tot denotes the total salary
    float sal, adv, tot;
    char n[50];
    
    int id, no;
} teacher, t;

// method declared to check the date
int check_date(int, int);

// method declared to add
// a new record
void add_new_record(int);

// method declared to update
// or modify a record
void update(int);

// method declared to find
// a record
void find_record(int);

// method declared to delete
// a record
void delete_record(int);

// method declared to find
// the salary of staff record
void find_record_salary(int);

// method declared to find 
// the fee of student record
void find_record_fee(int);

// declaring the files
FILE *fs, *ft;

// the variable mm denotes month
// the variable dd denotes date
int mm, dd;

// method declared to exit
// from the program
void exiting();

void start()
{
    // consider the required
    // variables in order to perform 
    // the function or method
    int i, j;

    system("cls");
    // enter the value of j
    // so that the type of the
    // record can be known by the
    // system in order to execute
    printf("\n\t\t Enter the type of the account from the following options !! ");
    printf("\n\t\t 1. Student account");
    printf("\n\t\t 2. Faculty and non-teaching staff account");
    printf("\n\t\t 3. Exit ");
    printf("\n\t\t Enter the option: ");
    fflush(stdin);

    // scanning the value of j
    scanf("%d", &j);

    // introducing a switch
    // case in which all the above cases
    // can be accessed and displayed
    switch (j)
    {
        // if the entered value
        // of j is 1
        case 1:
        {
            system("cls");
            printf("\n\t\t Enter the choice from the mentioned options below !! ");
            printf("\n\t\t1. Add a record");
            printf("\n\t\t2. Find a record");
            printf("\n\t\t3. Update a record");
            printf("\n\t\t4. Delete a record");
            printf("\n\t\t5. Find fee of a record");
            printf("\n\t\t6. Exit");
            printf("\n\n Enter the choice:  ");
            fflush(stdin);

            // scanning the choice
            scanf("%d", &i);

            // internal switch case
            // declared to access internal 
            // functions of the student record
            switch (i)
            {
                case 1:
                    add_new_record(j);
                    start();
                case 2:
                    find_record(j);
                    start();
                case 3:
                    update(j);
                    start();
                case 4:
                    delete_record(j);
                    start();
                case 5:
                    find_record_fee(mm);
                    start();
                case 6:
                    exiting();

                default :
                {
                    printf("\n\n\t The input entered is Invalid !! ");
                    
                    system("pause");
                    start();
                }
            }
        }
        case 2:
        {

            system("cls");
            printf("\n\t\t Enter the choice from the mentioned options below !! ");
            printf("\n\t\t1. Add a record");
            printf("\n\t\t2. Find a record");
            printf("\n\t\t3. Update a record");
            printf("\n\t\t4. Delete a record");
            printf("\n\t\t5. Find salary of a record");
            printf("\n\t\t6. Exit");
            printf("\n\n Enter the choice:  ");
            fflush(stdin);

            // scanning the choice
            scanf("%d", &i);

            switch (i)
            {
                case 1:
                    add_new_record(j);
                    start();
                case 2:
                    find_record(j);
                    start();
                case 3:
                    update(j);
                    start();
                case 4:
                    delete_record(j);
                case 5:
                    find_record_salary(mm);
                    start();
                case 6:
                    exiting();
                default :
                {
                    printf("\n\n\t The input entered is invalid");
                    
                    system("pause");
                    start();
                }

            }
        }
        case 3:
            exiting();
        default :
        {
            printf("\n\n\t The input entered is Invalid !! ");
            
            system("pause");
            start();
            
        }
        
    }
}

// main section
void main(void)
{
    int i, j, k;

    // loop initiation
    for(i = 0; i < 80; i++)
    {
        printf("\xdb");
    }
    printf("\n");

    for(i = 0; i < 80; i++)
    {
        printf("\xdb");
    }
    system("color 0f");
    
    printf("\t Welcome to the world of Programming in C\n");
    printf("\n\t You can work with the School Record System Project now !! \n");
    
    printf("\n\t Enter any key to continue !! ");

    
    /*for(i = 0; i < 5; i++)
    {
        // sleep time is 
        // 0.5 seconds
        // Sleep(500);

        // sleep takes place
        // when the execution of 
        // one operation is being
        // processed and the other
        // operation is ready to start
    }*/
    getch();

    // in order to clear 
    // the terminal screen
    system("cls");

    printf("\n");

    for(i = 0; i < 80; i++)
    {
        printf("\xdb");
    }
    system("color 6b");

    
    for(i = 0; i < 80; i++)
    {
        printf("\xdb");
    }
    printf("\nEnter any key to start the program !! \n");
    /*for(i = 0; i < 5; i++)
    {
        
        Sleep(500);
    }*/

    fflush(stdin);

    getch();

    system("cls");

    system("color 0f");

    printf("\n\t\tEnter the current Month and Date: ");
    scanf("%d %d", &mm, &dd);
    mm = check_date(mm, dd);
    start();
}

void add_new_record(int j)
{
    int differ, cdate, ddate, month = 0;
    float ff;
    char c = 'y';
    // initially declaring the required 
    // variables for the method
    printf("\n\n");
    printf(" YOU CAN ADD A NEW RECORD NOW !!");

    // condition if the given argument
    // is valued with 1
    // i.e. if the value of j
    // is 1, then the data will
    // be belonging to a student
    if(j == 1)
    {
        // iteration is initiated 
        // so that the statements 
        // can be repeated until the
        // condition fails

        while (c == 'Y' || c == 'y')
        {
            // if y is given
            // whether capital or
            // small alphabet " f "
            int a = 1;
            printf("\n");
            // taking the input of
            // name of the student
            printf(" Enter the full name of the student:");
            fflush(stdin);
            scanf("%[^\n]",student.n);

            // taking the input 
            // of the class of the 
            // new student
            printf(" Enter the class: ");
            fflush(stdin);
            scanf("%2d", &student.c);
            printf(" Enter the day and its month ");
            printf("until which the fee is already paid");
            fflush(stdin);
            scanf("%2d %2d", &cdate, &ddate);
            cdate = check_date(cdate, ddate);
            student.dt.m = cdate;
            ff = student.c / 10.0;
            student.f = 1000 * (1 + ff);
            differ =  mm - student.dt.m;
            student.fine = (differ * student.f) * 1 / 100;
            student.due = (differ) * student.f;
            if(differ == 1)
            {
                student.tot = student.f;
                student.fine = 0;
            }
            else
            {
                student.tot = student.fine + student.due;
            }
            fs = fopen(" student "," ab+ "); 
            fwrite(&student , sizeof(student), 1, fs);
            fclose(fs);
       printf("\n\n Will you continue ");
            printf("with the process? Y or N");

            fflush(stdin);
            c = getch();
        }
        getch();
    }
    if (j == 2)
    {
        while(c == 'y'||c == 'Y')
        {
            int a = 1;
            printf("\n\n Enter the name of the ");
            printf("faculty or non-teaching staff");
            fflush(stdin);
            scanf(" %[^\n]", teacher.n);
            printf("\n Enter the faculty ");
            printf("or non-teaching staff id:");
            fflush(stdin);
            scanf(" %d", &teacher.id);
            printf("\n Enter the number of classes ");
            printf("or shifts in a month: ");
            scanf(" %d", &teacher.no);
            fflush(stdin);
            printf("\n Enter the day and month until ");
            printf("which the salary is paid:");
            scanf(" %d %d", &teacher.dt.m, &teacher.dt.d);
            cdate = check_date(cdate, ddate);
            teacher.dt.m = cdate;
            teacher.sal = teacher.no * 500;
            teacher.adv = (teacher.dt.m - mm - 1) * teacher.sal;
            if (teacher.adv < 0) 
            {
                teacher.adv = 0;
            }
            teacher.tot = teacher.sal;
            ft = fopen("teacher","ab+");
            fwrite(&teacher, sizeof(teacher), 1, ft);
            fclose(ft);
            printf("\n\n Will you continue ");
            printf("with the process? Y or N");
            fflush(stdin);
            c = getch();
        }
        fflush(stdin);
        printf("\n\n");
        system("pause");
    }
}

void find_record(int j)
{
    // consider the required
    // variables and declare them
    char sname[50],tname[50];
    int a = 1, choice;
    char c = 'y';
    // check the condition for which 
    // the records must be searched
    // condition verification regarding
    // the student details
    // or faculty details

    // if the student data is 
    // supposed to be searched
    if (j == 1)
    {
        // while the user replies
        // yes to continue
        while(c == 'Y'||c == 'y')
        {
            int a = 1;
            
            printf("\n\n\t\t How do you want to search?");
            printf("\n\n\t\t 1. Want to search by name:");
            printf("\n\n\t\t 2. Want to search by class:");
            printf("\n\n\t\t 3. Want to search by roll number:");
            printf("\n\n\t\t 4. Exit");
            printf("\n\n\t\t Enter your desired choice: ");
            fflush(stdin);
            scanf("%d", &choice);
            // if the user wants to
            // search the record by name
            // of the student
            if (choice == 1)
            {
                a = 1;
                printf("\n\n Enter the name of the ");
                printf("student that you want to find: ");
                fflush(stdin);
                // scanning the name of the student
                scanf("%[^\n]", sname);
                fs=fopen(" student "," rb ");
                while(fread(&student, sizeof(student), 1, fs) == 1)
                {
                    if (strcmp(sname, student.n) == 0)
                    {
                        a = 0;
                        printf("\n Name of the student is %s", student.n);
                        printf("\n Class of the student is %d", student.c);
                        printf("\n The roll number of the student is %d", student.r);
                        printf("\n Monthly fee of the student is %.2f",student.f);
                        printf("\n Fee paid previously is in the month %2d",student.dt.m);
                        printf("\n Due left is %.2f",student.due);
                        printf("\n Fine to be paid is %.2f",student.fine);
                        printf("\n Total is %.2f\n\n", student.tot);
                    }
                }
                if (a == 1)
                    printf("\n\n The record that you ");
                    printf("are searching for is not found.\n\n");
                system("pause");
                fflush(stdin);
                fclose(fs);
            }
            // if the user wants to 
            // search the record by using
            // the class of the student
            else if (choice == 2)
            {
                int cl;
                a = 1;
                printf("\n\n Enter the class of the student ");
                printf("in order to find his or her details: ");
                fflush(stdin);
                cl = clscanf();
                fs = fopen(" student "," rb ");
                while(fread(&student, sizeof(student), 1, fs) == 1)
                {
                    if (student.c == cl)
                    {
                        a  = 0;
                        printf("\n Name of the student is %s", student.n);
                        printf("\n Class of the student is %d", student.c);
                        printf("\n The roll number of the student is %d", student.r);
                        printf("\n Monthly fee of the student is %.2f",student.f);
                        printf("\n Fee paid previously is in the month %2d",student.dt.m);
                        printf("\n Due left is %.2f",student.due);
                        printf("\n Fine to be paid is %.2f",student.fine);
                        printf("\n Total is %.2f",student.tot);
                    }
                }
                if (a == 1)
                    printf("\n\n The record that you are ");
                    printf("searching for is not found.\n\n");
                system("pause");
                fflush(stdin);
                fclose(fs);
            }
            // if the user wants to 
            // search the record by using
            // the roll number of the student
            else if (choice == 3)
            {
                int roll;
                a = 1;
                printf("\n\n Enter the roll number of the ");
                printf("student in order to find the details: ");
                fflush(stdin);
                roll = clscanf();
                fs = fopen(" student "," rb ");
                while(fread(&student, sizeof(student), 1, fs) == 1)
                {
                    if (roll == student.r)
                    {
                        a = 0;
                        printf("\n Name of the student is %s", student.n);
                        printf("\n Class of the student is %d", student.c);
                        printf("\n The roll number of the student is %d", student.r);
                        printf("\n Monthly fee of the student is %.2f",student.f);
                        printf("\n Fee paid previously is in the month %2d",student.dt.m);
                        printf("\n Due left is %.2f",student.due);
                        printf("\n Fine to be paid is %.2f",student.fine);
                        printf("\nTotal is %.2f",student.tot);
                    }
                }
                if (a == 1)
                    printf("\n\n The record that you are ");
                    printf("searching for is not found.\n\n");
                system("pause");
                fflush(stdin);
                fclose(fs);
            }
            // if the user desires 
            // to exit 
            else if(choice == 4)
            {
                exiting();
            }
            else
            {
                printf("\n\n\n\t\t The given input is invalid.\n\n\t\t");
                system("pause");
                find_record(1);
            }
            printf("\n\n If you want to continue, then press y or Y");
            fflush(stdin);
            c = getch();
        }
        getch();
    }

    // if the faculty data or 
    // non-teaching staff data is 
    // supposed to be searched
    if (j == 2)
    {
        while(c  == 'Y'||c == 'y')
        {
            int a=1;
            printf("\n\n Enter the name of the ");
            printf("faculty or non-teaching staff ");
            printf("to find their details: ");
            fflush(stdin);
            scanf("%[^\n]", tname);
            ft=fopen(" teacher "," rb ");
            while(fread(&teacher, sizeof(teacher), 1, ft) == 1)
            {
                // checking the condition
                // whether the given input matches
                // any of the data or record
                // by checking with the corresponding 
                // name of the faculty 
                // or non-teaching staff
                if (strcmp(tname, teacher.n) == 0)
                {
                    a = 0;
                    printf("\n The name of the teacher is %s", teacher.n);
                    printf("\n The id of the teacher is %d", teacher.id);
                    printf("\n Last month when the salary is paid is %d", teacher.dt.m);
                    printf("\n The salary that is paid per month is %.2f", teacher.sal);
                    printf("\n The advance salary paid is %.2f",teacher.adv);
                }
            }
            if (a == 1)
                printf("\n\n The record that you are searching ");
                printf("for is not found.");
            printf("\n\n");
            system("pause");
            fflush(stdin);
            fclose(ft);
            printf("\n\n If you still want to continue ");
            printf("with the process, then press Y or y");
            fflush(stdin);
            c=getch();
        }
        getch();
    }

}

void update(int j)
{
    // consider the required
    // variables in order to perform 
    // the function or method

    // name of the record
    // either student or faculty
    // or non-teaching staff
    char name[50];
    int a = 1;

    int choice, cl, roll;
    char c = 'y';

    // if the user wants to
    // modify the details of 
    // the student
    // then he or she must
    // choose j as 1
    if ( j == 1 )
    {
        // a loop that repeats 
        // until the process is 
        // completed and the base
        // condition becomes false
        while( c == 'y' || c == 'Y' )
        {
            system("cls");
            printf(" You can modify the record now!! ");
            printf("\n\n\t\t Choose the type of ");
            printf("modification that you want to perform.");
            printf("\n\n\t\t 1. Modify by the name");
            printf(" of the student ");
            printf("\n\n\t\t 2. Modify by the name ");
            printf("and class of the student ");
            printf("\n\n\t\t 3. Modify by the name, ");
            printf("roll number and class of the student ");
            printf("\n\n\t\t 4. Exit ");
            printf("\n\n\t\t Out of the above options, ");
            printf("enter one choice number: ");
            fflush(stdin);
            scanf(" %d", &choice);
            // if the user chooses 
            // to modify the details
            // using name of the student
            if ( choice == 1 )
            {
                int a = 0;
                printf("\n\n Enter the name of the student");
                printf(" that you want to modify: ");
                fflush(stdin);
                // scanning the name of 
                // the student
                scanf(" %[^\n]",name);
                fs=fopen("student","rb+");
                while( fread(&student, sizeof(student), 1, fs) == 1 )
                {
                    a=1;
                    if ( strcmp(name, student.n) == 0 )
                    {
                        a=0;
                        printf("\n Enter the new name of the student");
                        printf(" that you want to modify: ");
                        fflush(stdin);
                        // scanning the new name
                        // of the student
                        scanf(" %[^\n]",student.n);
                        printf("\n Enter the new class of the student");
                        printf(" that you want to modify: ");
                        fflush(stdin);
                        // scanning and modifying the
                        // new class of the student
                        student.c = clscanf();
                        printf("\n Enter the new roll number ");
                        printf("of the student that you want to modify: ");
                        fflush(stdin);
                        // scanning the new roll  
                        // number of the student 
                        scanf("%d", &student.r);
                        fseek(fs, sizeof(student), SEEK_CUR);
                        fwrite(&student, sizeof(student), 1, fs);
                        fclose(fs);
                    }
                }
                if ( a == 1 )
                {
                    printf("\n\n The record that you ");
                    printf("are searching for is not ");
                    printf("found !!");
                }
                    
                else
                {
                    printf("\n\n The chosen records are ");
                    printf("successfully modified !!");
                }
                    
                printf("\n\n");
                system("pause");
            }
            // if the user chooses 
            // to modify the details
            // using name and class 
            // of the student
            else if ( choice == 2 )
            {
                int a = 0;
                printf("\n\n Enter the name of the student ");
                printf("that you want to modify: ");
                fflush(stdin);
                // scanning the name of the
                // student that you want to
                // modify
                scanf(" %[^\n]",name);
                printf("\n\n Enter the class of the student ");
                printf("that you want to modify: ");
                fflush(stdin);
                // scanning the class of the 
                // student that you want to
                // modify
                cl=clscanf();
                fs=fopen(" student "," rb+ ");
                while( fread(&student, sizeof(student), 1, fs) == 1 )
                {
                    a=1;
                    if ( strcmp(name, student.n) == 0 && cl == student.c )
                    {
                        a=0;
                        printf("\n Enter the new name of the student ");
                        printf("that you want to modify: ");
                        fflush(stdin);
                        // scanning the new name of the 
                        // student that you want to
                        // modify
                        scanf("%[^\n]", student.n);
                        printf("\n Enter the new class of the student ");
                        printf("that you want to modify: ");
                        fflush(stdin);
                        // scanning the new class of the 
                        // student that you want to
                        // modify
                        student.c = clscanf();
                        printf("\n Enter the new roll number of ");
                        printf("the student that you want to modify: ");
                        fflush(stdin);
                        // scanning the new roll number 
                        // of the student that you want 
                        // to modify
                        scanf("%d", &student.r);
                        fseek(fs, sizeof(student), SEEK_CUR);
                        fwrite(&student, sizeof(student), 1, fs);
                        fclose(fs);
                    }
                }
                if ( a == 1 )
                {
                    printf("\n\n The record that you ");
                    printf("are searching for is not ");
                    printf("found !!");
                }
                    
                else
                {
                    printf("\n\n The chosen records are ");
                    printf("successfully modified !!");
                }
                    
                printf("\n\n");
                system("pause");
            }
            // if the user chooses 
            // to modify the details
            // using name, class and 
            // roll number of the student
            else if ( choice == 3 )
            {
                int a = 0;
                printf("\n\n Enter the name of the student ");
                printf("that you want to modify: ");
                fflush(stdin);
                // scanning the name of the
                // student that you want to
                // modify
                scanf(" %[^\n]",name);
                printf("\n\n Enter the class of the student ");
                printf("that you want to modify: ");
                fflush(stdin);
                // scanning the class of the 
                // student that you want to
                // modify
                cl = clscanf();
                printf("\n\n Enter the roll number of the ");
                printf("student that you want to modify: ");
                fflush(stdin);
                // scanning the roll number of the 
                // student that you want to
                // modify
                scanf("%d", &roll);
                fs=fopen(" student "," rb+ ");
                while( fread(&student, sizeof(student), 1, fs) == 1 )
                {
                    a = 1;
                    if (strcmp(name, student.n) == 0 && cl == student.c && roll == student.r)
                    {
                        a = 0;
                        printf("\n Enter the new name of the student ");
                        printf("that you want to modify: ");
                        // fflush(stdin);
                        // scanning the new name of the 
                        // student that you want to
                        // modify
                        scanf(" %[^\n]",student.n);
                        printf("\n Enter the new class of the student ");
                        printf("that you want to modify: ");
                        fflush(stdin);
                        // scanning the new class of the 
                        // student that you want to
                        // modify
                        student.c = clscanf();
                        printf("\n Enter the new roll number of ");
                        printf("the student that you want to modify: ");
                        fflush(stdin);
                        // scanning the new roll number 
                        // of the student that you want 
                        // to modify
                        scanf("%d", &student.r);
                        fseek(fs, sizeof(student), SEEK_CUR);
                        fwrite(&student, sizeof(student), 1, fs);
                        fclose(fs);
                    }
                }
                if (a == 1)
                {
                    printf("\n\n The record that you ");
                    printf("are searching for is not ");
                    printf("found !!");
                }
                    
                else
                {
                    printf("\n\n The chosen records are ");
                    printf("successfully modified !!");
                }
                    
                printf("\n\n");
                system("pause");
            }
            // if the user chooses to exit
            // from the portal
            else if (choice == 4)
                exiting(0);

            // if an invalid entry
            // is given
            else
            {
                printf("\n\n\n\t\t The given input for choice ");
                printf("is not valid\n\n\t\t");
                system("pause");
                update(1);
            }

            printf("\n\n If you still wish to continue with ");
            printf("the above process the press y or Y");
            fflush(stdin);
            c=getch();
        }
        getch();
    }
    // if the user wants to
    // modify the details of 
    // the faculty or 
    // non-teaching staff,
    // then he or she must
    // choose j as 2
    if ( j == 2 )
    {
        while( c == 'y' || c == 'Y' )
        {
            int a=1;
            printf(" Enter the name of the faculty");
            printf(" or the non-teaching staff");
            printf(" that you want to modify: ");
            fflush(stdin);
            // scanning the name of the
            // faculty or the 
            // non-teaching staff
            scanf("%[^\n]", name);
            ft = fopen(" teacher "," rb+ ");
            while( fread(&teacher, sizeof(teacher), 1, ft) == 1)
            {
                if ( strcmp(name, teacher.n) == 0)
                {
                    a=0;
                    printf("\n Enter the new name of ");
                    printf("the faculty or non-teaching");
                    printf(" staff that you want to modify: ");
                    fflush(stdin);
                    // scanning the new name of the faculty
                    // or the non-teaching staff
                    scanf("%[^\n]", teacher.n);
                    printf("\n Enter the new id of the ");
                    printf("faculty or the non-teaching");
                    printf(" faculty that you want to modify: ");
                    fflush(stdin);
                    // scanning the new id of the faculty
                    // or the non-teaching staff
                    scanf("%d", &teacher.id);
                    fseek(ft, sizeof(teacher), SEEK_CUR);
                    fwrite(&teacher, sizeof(teacher), 1, ft);
                    fclose(ft);
                }
            }

            if (a == 1)
            {
                printf("\n\n The record that you ");
                printf("are searching for is not ");
                printf("found !!");
            }
                
                else
                {
                    printf("\n\n The chosen records are ");
                    printf("successfully modified !!");
                }
                    
                printf("\n\n");
            system("pause");
            fflush(stdin);

            printf("\n\n If you still wish to continue with ");
            printf("the above process the press y or Y");
            fflush(stdin);
            c = getch();
        }
        getch();
    }
}

void delete_record(int j)
{
    system("cls");
    
    printf("You have entered the deletion block !!");
    // declare and define the 
    // required variables
    // for performing deletion
    // operation

    // name of the record
    // either student or faculty
    // or non-teaching staff
    FILE *temp, *t1;
    int a = 1;
    char name[50], c = 'y';

    // if the user wants to
    // delete the details of 
    // the student
    // then he or she must
    // choose j as 1
    if ( j == 1 )
    {
        // a loop that repeats 
        // until the process is 
        // completed and the base
        // condition becomes false
        while(c == 'y' || c == 'Y' )
        {
            int a = 1;
            printf("\n\n Enter the name of student ");
            printf("whose record you want to delete: ");
            fflush(stdin);

            // scanning the name of the
            // student
            scanf(" %[^\n]", name);

            // opening the file in read mode
            fs = fopen("student", "rb");

            // consider a temp variable
            // which is set to open the file
            // in write mode
            temp = fopen(" tempfile ", " wb ");

            // when the name of the student 
            // entered is equal to one of the 
            // names that are present within
            // the records
            while ( fread(&student, sizeof(student), 1, fs) == 1 )
            {
                // deleting the student's record
                // if the details are matched with
                // the found record
                if ( strcmp(student.n, name) == 0 )
                {
                    a = 0;
                    continue;
                }
                else
                {
                    fwrite(&student, sizeof(student), 1,  temp);
                }
            }
            // if any record is not
            // yet deleted
            if ( a == 1 )
            {
                printf("\n\n The record that you are");
                printf(" searching for is not found !!");
            }
                
            else
            {
                printf("\n\n The deletion of record ");
                printf(" is completed successfully !!");
            }
                
            printf("\n\n");
            system("pause");
            fflush(stdin);

            fclose(fs);
            fclose(temp);
            system("del student");

            // the data that is supposed to
            // be deleted is initially stored
            // in a temporary variable " temp "
            // which is further lead to deletion
            system("ren tempfile, student");
       //renaming temp to student
            printf("\n\n If you still wish to continue with the process, press y or Y");
            fflush(stdin);
            c = getch();
        }
        getch();
    }
    // if the user wants to
    // delete the details of 
    // the faculty or
    // non-teaching staff, 
    // then he or she must
    // choose j as 2
    if ( j == 2 )
    {
        a = 1;
        char namet[50];
        while( c == 'y' || c == 'Y' )
        {
            printf("\n\n Enter the name of the ");
            printf("faculty or non-teaching ");
            printf("staff that you want to delete: ");
            fflush(stdin);
            // scanning the name of 
            // the faculty or non-teaching
            // staff
            scanf("%[^\n]", namet);

            ft=fopen(" teacher ", " rb ");
            t1=fopen(" tempfile1 ", " wb ");
            while ( fread(&teacher, sizeof(teacher), 1, ft) == 1 )
            {
                if ( strcmp(teacher.n, namet) == 0 )
                {
                    a = 0;
                    continue;
                }
                else
                {
                    fwrite(&teacher, sizeof(teacher), 1, t1);
                }
            }

            if ( a == 1 )
            {
                printf("\n\n The record that you are");
                printf(" searching for is not found !! ");
            }
                
            else
            {
                printf("\n\n The deletion of the record");
                printf(" is completed successfully !! ");
            }
                
            printf("\n\n");
            system("pause");
            fflush(stdin);

            fclose(ft);
            fclose(t1);
            system("del teacher");
            system("ren tempfile1, teacher");
            printf("\n\n If you still wish to continue with the process, press y or Y");
            fflush(stdin);
            c = getch();
        }
        getch();
    }
}

void find_record_salary(int mm)
{
    system("cls");
    
    // consider the required
    // variables in order to perform 
    // the function or method

    
    FILE *f, *t;
    int a = 1, day;

    // name of the record
    // either faculty record
    // or non-teaching staff
    // record
    char name[50], c = 'y';
    int month, differ, id;

    // a loop that repeats 
    // until the process is 
    // completed and the base
    // condition becomes false
    while(c == 'y'|| c == 'Y')
    {
        int a = 1;
        fflush(stdin);
        printf("\n\n Enter the name ");
        printf("of the faulty or ");
        printf("non-teaching staff record: ");

        // scanning the name 
        // of the faculty record
        // or the non-teaching
        // staff record
        scanf(" %[^\n]", name);
        printf("\n\n Enter the id of the ");
        printf("faculty record or non-teaching");
        printf(" staff record: ");

        // scanning the id of the
        // faculty record or
        // non-teaching staff record
        scanf(" %d",&id);

        f = fopen(" teacher "," rb+ ");
        t=fopen(" te "," wb+ ");

        // through the below base condition
        // within the while loop,
        // the file is successfully opened
        while(fread(&teacher, sizeof(teacher), 1, f) == 1)
        {
            // the name that is entered through
            // the input is verified and compared
            // with the existing names within the 
            // database of records
            if(strcmp(teacher.n, name) == 0 )
            {
                float lsal;
                a = 0;
                printf("\n\n Enter the month in which ");
                printf("the last salary is paid");
                fflush(stdin);

                // scanning the month in which the
                // last salary is paid
                scanf("%d", &month);

                // the month is assigned with
                // the method calling, i.e.,
                // check_date method 
                // with two parameters, i.e., month 
                // and day
                month = check_date(month, day);

                // the advance that is already
                // given to the staff
                // is being calculated here
                teacher.adv = (month - mm - 1) * teacher.sal;
                if (teacher.adv < 0)
                {
                    teacher.adv = 0;
                }

                // the month where last
                // salary is paid and no.
                // of months the salary must 
                // be paid
                lsal = mm - teacher.dt.m;

                if(lsal < 0)
                {
                    lsal = 0;
                }
                teacher.tot = teacher.adv + teacher.sal * (1 + lsal);
                if(month == teacher.dt.m) 
                {
                    teacher.tot = 0;
                }
                printf("\n The left over monthly salary that is");
                printf(" supposed to be paid is %.2f",lsal);

                printf("\n The total salary is %.2f",teacher.tot);
                printf("\n The advance salary given is %.2f",teacher.adv);
                teacher.dt.m = month;
                fwrite(&teacher, sizeof(teacher), 1, t);
                fclose(f);
                fclose(t);

                if (a == 1)
                {
                    printf("\n\n The record that you are");
                    printf(" searching for is not found !!");
                }
                else
                {
                    printf("\n\n The salary details ");
                    printf("have been accurately printed !!");
                }
                    
                printf("\n\n");
                system("pause");
                fflush(stdin);
                system("del teacher");
                system("ren te, teacher");
            }
        }
        printf("\n\n If you still wish to continue, press y or Y");
        fflush(stdin);
        c = getch();
    }
    getch();
}

void find_record_fee(int mm)
{
    // consider the required
    // variables in order to perform 
    // the function or method
    
    FILE *f, *t;
    int a = 0;

    // name of the student
    // record
    char name[50], c = 'y';
    int class, roll, month, differ;

    // a loop that repeats 
    // until the process is 
    // completed and the base
    // condition becomes false
    while(c == 'y' || c == 'Y')
    {
        int a = 1, day = 0;
        fflush(stdin);
        printf("\n\n Enter the name of ");
        printf("the student that you want ");
        printf("to find the fee details: ");

        // scanning the name 
        // of the student record
        scanf("%[^\n]",name);         
        printf("\n\n Enter the class of the ");
        printf("student that you want to find");
        printf(" the fee details: ");
        fflush(stdin);

        // scanning the class
        // of the student record
        class = clscanf();

        printf("\n\n Enter the roll number ");
        printf("of the student that you want to find");
        printf(" the fee details: ");
        fflush(stdin);

        // scanning the roll number 
        // of the student record
        scanf("%d", &roll);

        // opening the student file
        // in read mode
        f = fopen("student","rb+");

        // write mode
        t = fopen("te","wb");

        // through the below base condition
        // within the while loop,
        // the file is successfully opened
        while(fread(&student, sizeof(student), 1, f) == 1)
        {
            // the name, class and roll number
            // that is entered through
            // the input is verified and compared
            // with the existing names within the 
            // database of records
            if(strcmp(student.n, name) == 0 && class == student.c && roll == student.r)
            {
                a = 0;
                printf("\n\n Enter the last month upto ");
                printf("which the fee is paid: ");
                fflush(stdin);

                // scanning the month
                // in which the last 
                // fee is paid
                scanf("%d", &month);

                month = check_date(month, day);
                differ = mm - student.dt.m;
                student.fine = (differ * student.f) * 0.01;
                student.due = (differ) * student.f;
                if (student.fine < 0)
                {
                    student.fine = 0;
                } 
                if (student.due < 0)
                {
                    student.due = 0;
                } 
                if (student.tot < 0)
                {
                    student.tot=0;
                } 
                student.tot = student.fine + student.due + student.adv;
                printf("\n The fine that");
                printf(" the student is supposed to pay is");
                printf(" %.2f", student.fine);
                printf("\n The left due that");
                printf(" the student is supposed to pay is");
                printf(" %.2f", student.due);
                printf("\n The total amount that");
                printf(" the student is supposed to pay is");
                printf(" %.2f", student.tot);
                printf("\n The advance amount that");
                printf(" the student has already paid is");
                printf(" %.2f", student.adv);
                student.dt.m = month;
                student.tot = 0;
                student.fine = 0;
                student.due = 0;
                fwrite(&student, sizeof(student), 1, t);
            }
        }
        if (a == 1)
        {
            printf("\n\n The record that you are");
            printf("searching for is not found !!");
        }
            
        printf("\n\n");
        system("pause");
        fflush(stdin);

        fclose(f);
        fclose(t);
        system("del student");
        system("ren te, student");
        printf("\n\n If you still wish to continue the process, press y or Y");
        fflush(stdin);
        c = getch();
    }
    getch();
}

int check_date(int month, int date)
{
    // consider the required
    // variables in order to perform 
    // the function or method
    int mon, day;

    // the condition defines that the month
    // less than or equal to 12 and greater
    // than or equal to 1
    // Similarly, date is greater than
    // or equal to 1 and less than 
    // or equal to 31

    // if any one of the above 
    // conditions are failed
    // the method enters the if condition
    // and prints that the entered
    // date is invalid
    if (month > 12 || month < 1 || date < 1 || date > 31)
    {
        

        fflush(stdin);
        scanf("%d %d", &mon, &day);
        mon = check_date(mon, day);
    }
    else
        return (month);
}

int clscanf()
{

    // declare the required 
    // variables
    int month, mon;
    fflush(stdin);

    // scanning the month 
    scanf("%d", &month);
    if (month > 12 || month < 1)
    {

       
        fflush(stdin);
        mon = clscanf();
    }
    else
        return month;
}   

void exiting()
{
    // declaring the required
    // variables
    int i;

    system("color 0c");
    printf("\n\n\t\t You have chosen to");
    printf(" exit from the program\n\n");
    printf("\n\n\t\t Thank you !!\n\n");

    system("pause");
    system("cls");

    printf("\n\n\t\t\t Exiting from the program\n\n");

    // loop declaration
    // in order to 
    // perform wait operation
    for(i = 1; i <= 80; i++)
    {
        //Sleep(50);
        printf("*");
    }
    exit(0);
}

The program above integrates all the techniques covered earlier, with slight adjustments to meet the program's needs. Running this program will display a window containing various statements as per the user's request. Let's execute the program and examine the output.

The output of the above program:

The image below showcases the program interface upon activation.

Once this window is visible on the display, you can verify that the code execution has commenced and the operation is proceeding smoothly. Upon encountering this interface, proceed by pressing any key to proceed with the subsequent steps.

For additional verification, the user is prompted to input any key on the subsequent screen as well. Once the user inputs a key, this screen vanishes, revealing the following screen.

As demonstrated in the screen above, the system prompts the user to input the current month and date, requiring them to enter the information accordingly.

The image above illustrates the interface displaying various choices for selecting the account type. When opting for the student account, the user inputted the number 1. Upon selecting this option, the following choices will be presented.

Among the available choices concerning the student account, a decision needs to be made to proceed. The first step involves inserting a new entry into the internal database. Therefore, the selection "Insert a record" should be opted for, and its corresponding identification number, namely, 1, should be inputted.

Once the student's information has been inputted, the next step involves selecting the student account and opting for the "Locate a record" feature to verify the storage of the previously provided details.

When input 2 is selected, the system will be prepared to locate a specific record based on provided credentials. The user will then be prompted to specify their preferred method of searching for the record. If the user wishes to search by the name of the record, they can opt for option 1.

After selecting option 1, the following screen will appear. Input the student's name to retrieve their information.

When a student's name is provided and submitted, the system will showcase the specific student's information, as demonstrated in the image above. Similarly, the functionality of the educational institution's billing system extends to managing teacher accounts as well.

If the user wishes to proceed, a prompt will be displayed to confirm the execution of the program. To continue, the user must input either " y " or " Y ". Inputting any other key will halt the program execution and exit. This is the operational flow of the School Billing System program written in C.

Input Required

This code uses input(). Please provide values below: