Student Record System In C

A programmatically created database that holds comprehensive student information such as the student's first and last name, roll number, CGPA, and registered courses. This database ensures the security of student data and enables efficient retrieval when needed. Our upcoming program will be constructed using switch cases and fundamental components of the chosen programming language.

The operations that can be performed using the Student record System are:

  • Add the Student details
  • Retrieve the Student data with a roll number
  • Retrieve the Student data with a first name
  • Total number of Students registered in a particular course
  • Delete a Student data
  • Update a Student data
  • Total number of Students

Let's divide the software into segments, each containing a method that explains one of the operations mentioned earlier, in a step-by-step manner. Once all the methods for the operations are identified, we can combine them to create a software system dedicated to managing and displaying the Student Record System. This approach enhances the accessibility and comprehensibility of our work.

1. add_student:

This function facilitates the inclusion of information about a fresh Student. It acquires input from the user and inserts this information into the Student database by saving it within the system. Furthermore, it validates the uniqueness of the roll number when incorporating the Student's particulars since each student's roll number must be distinct. Now, let's delve into a program that elaborates on the "add_student" method.

A program showcasing the function "add_student" that handles the process of including information about fresh students:

Example

// method that is declared 
// to scan the details of a new students
// or to add the new student details to the database

// use the method add_student() 
void add_student()
{
    printf("You can add the Student data now !! \n");

    // entering the first name of the student
    printf("Enter the first name of the Student: ");
    // scan the first name of the student by using the scanf statement
    st[i].f_name = "Nikki";
    // (I've directly entered the first name to have a                                   glance )
    
    // entering the last name of the student
    printf("Enter the last name of the Student: ");
    // scan the last name of the student by using the scanf statement
    st[i].l_name = "Manne";

    // entering the roll number of the student
    printf("Enter the roll number of the Student: ");
    // scan the roll number of the student by using the scanf statement
    st[i].r_no = 27;

    // entering the CGPA of the student
    printf("Enter the CGPA that the student achieved: ");
    // scan the CGPA of the student by using the scanf statement
    st[i].cgpa = 9;

    // entering the course id of each course to register
    printf("List of courses with their respective course ids: ");
    
    // iteration used for storing 
    // the enrolled courses of every student
    for(int j = 0; j<5; j++)
    {
        // storing the j value 
        // in the corresponding
        // course number
        st[j].cid[j] = j;
    }
    // increasing the value number of students 
    // by 1 after every iteration
    // as the details of the new student are entered
    i++;

}

An explanation for the above Program or method:

The function "add_student" is utilized to input the information of a new student. This process involves manually entering each detail step by step, and ultimately, saving the data in the system's database. As per specifications, the variables are defined and set with an initial value. For instance, the variable j is set to "0" for it to begin iterating from the 0th position. Similarly, other variables like roll number, first name, etc., are declared to capture user inputs. The entire procedure of collecting student information occurs within the body of this function.

The values are acquired through scanning with the "scanf" function, while the details are displayed by iterating through loops. This method is straightforward, incorporating fundamental elements such as loops, print and scan statements. Student information is gathered based on their respective data types, demonstrating the functionality of the "add_student" method.

2. find_using_roll:

This function is employed to retrieve comprehensive information about a particular student based on their unique roll number. It requires the roll number of the student as an input to fetch and display the corresponding details. Assigning distinct roll numbers to students ensures the safeguarding of their identities and facilitates effortless data retrieval by simply utilizing the roll number. To grasp this concept better, let's explore a program that elaborates on the functionality of the "findusingroll" method.

A software application showcasing the function "findusingroll" that executes the process of fetching the information of a student based on their roll number:

Example

// method that is declared 
// to scan the roll number of a student
// and print all the details 
// of the respective student bearing the roll number

// use the method find_using_roll() 
void find_using_roll()
{
    int roll;
    printf("You can find the Student data ");
    printf("by entering a roll number now !! \n")

    // scanning the roll number of the student
    printf("Enter the roll number of the Student: ");
    // scan the roll number of the student by using the scanf statement
    roll = 23;
    // (I've directly entered the roll number to have a 
    // glance )
    // in order to find the details
    // we are iterating through all the details 
    // of the students present within the data
    // using a for loop
    for (int j = 0; j < i; j++) 
    {
 
        // If the condition denotes the situation 
        // where the roll number is found
        if (roll == st[j].r_no) 
        {
            printf("The details of the Student ");
            printf("with the roll number ",roll," are\n");

            // printing the first name of the student
            printf("The First name of the student is %s\n", st[j].f_name);
            printf("The Last name of the student is %s\n", st[j].l_name);
            printf("The CGPA of the student is %f\n", st[j].cgpa);
            
            // Printing the list of names of the courses
            // which are enrolled by the student

            // iteration used for displaying 
            // all the 5 courses 
            // that are enrolled by the student
		  // using a " for " loop
            for (int k = 0; k < 5; k++) 
            {
                printf("The course ID is %d\n", st[j].cid[k]);
            }
            break;
        }
    }
    

}

A comparison between the current program or function and the previously covered method:

The function " findusingroll " is defined in a distinct manner compared to the initial function " addstudent ". In " addstudent ", all student details are provided as input, regardless of the specifics, to append a new student's information. Conversely, " findusingroll " requires the existing student's roll number as input, enabling the retrieval of the student's complete details associated with the provided roll number. The entire process of entering student information occurs within the body of this function or method, illustrating the disparity between " addstudent " and " findusing_roll ".

The starting point is established using the roll number, cross-referencing it with the student records. Once a match is identified, the specific student's information is displayed. The subsequent steps within the "findusingroll" function mirror those in the "addstudent" function. This process outlines the functionality of the "findusing_roll" method.

3. find_using_fname:

This function is employed to retrieve all the information related to a particular student based on their first name input. Therefore, the function "findusingfname" requires the first name of the student as an input to fetch the details of the student associated with that specific first name (via the input provided). To grasp this idea better, let's explore a program that illustrates the functionality of the "findusingfname" method.

A program showcasing the function "findusingfname" that executes the process of retrieving Student information based on their first name:

Example

// method that is declared 
// to scan the first name of a student
// and print all the details 
// of the respective student bearing the first name

// use the method find_using_fname() 
void find_using_fname()
{
    char name[50];
    printf("You can find the Student data ");
    printf("by entering the first name now !! \n")

    // scanning the first name of the student
    printf("Enter the first name of the Student: ");
    // scan the first name of the student by using the scanf statement
    f_name = "Nikhitha ";
    // (But I've directly entered the first name
    // in order to have a glance )
 
    // to find the details of the student,
    // we are iterating through all the details 
    // of the students present within the data

    // using a for loop
    for (int j = 0; j <= i; j++) {
 
        // If the condition denotes the situation 
        // where the first name is being searched is found

	  // the strcmp() compares the given two strings
        // by comparing each character one by one
        // and if the strings are the same
        // then the function returns 0

        if (!strcmp(st[j].f_name, name)) 
        {
 
            printf("The details of the student are displayed below\n");
            printf("The First name of the student is %s\n", st[j].f_name);
            printf("The Last name of the student is %s\n", st[j].l_name);
            printf("The Roll Number of the student is %d\n ", st[j].r_no);
            printf("The CGPA of the student is %f\n", st[j].cgpa);
            
            // Printing the list of names of the courses
            // which are enrolled by the student

            // iteration used for displaying 
            // all the 5 courses 
            // that are enrolled by the student
            for (int k = 0; k < 5; k++) 
            {
                printf("The course ID is %d\n", st[j].cid[k]);
            }
           
        }
    }
}

A detailed clarification for the aforementioned program or function in contrast to the methods analyzed earlier:

The function " findusingfname " is defined in a distinct manner compared to the initial function " addstudent ", yet it resembles the function " findusingroll ". " addstudent " function requires input for all student details regardless of the criteria and records the data for a new student. This function or method is responsible for handling the entire process of entering student information.

However, the function "retrievebyrollnumber" requires the current student's roll number as input to retrieve all their information. Similarly, the function "retrievebyfirstname" prompts for the existing student's first name to display all their details. This commonality is a significant feature shared by "retrievebyfirstname" and "retrievebyrollnumber".

The initial condition is set using the initial name, and all student information is cross-referenced with this initial name. Upon discovering a match, the information pertaining to that specific student is displayed. The remaining steps in the functionality of the "findusingfname" function mirror those of the "addstudent" function and are identical to those of the "findusingroll" method. This outlines the process flow of the "findusing_fname" function.

5. find_using_course:

This function is employed to retrieve information about the total number of students registered in a specific course by using the course ID as an argument. Therefore, the " findusingcourse " function accepts the course ID as input and subsequently displays the comprehensive details of the students enrolled in the specified course. To delve deeper into this process of retrieving information, let's explore a program that elaborates on the functionality of the method " findusingfname ".

A program showcasing the function "findusingcourse" that executes the process of fetching information about students who are registered in a specific course by utilizing the course ID:

Example

// method that is declared 
// to scan the course id
// and print all the details 
// of the students who have enrolled 
// that particular course

void find_using_course()
{
    int id;
    printf("You can find the Student data ");
    printf("who have enrolled in the course. ");
    printf("Enter the course ID of the desired course: \n");
 
    // scanning the course id
    // scan the course id of by using the scanf statement
    id = 21;
    // (I've directly entered the course id
    // to have a glance )
 

    // in order to find the details,
    // we are iterating through all the details 
    // of the students present within the data
    // with the given course id

    // using a for loop
    // and the iteration continuous 
    // until the iteration variable
    // is less than or equal to 
    // the maximum number of students
    // registered in that course
    for (int j = 0; j <= i; j++) 
    {
 
        // iteration being processed
        // in order to get the list of students
        // who have registered for the 
        // given course id
        for (int d = 0; d < 5; d++) 
        {
            // checking the condition
            // for a match
            // with the given course id
            if (id == st[j].cid[d]) 
            {
 
                printf("The details of the Students ");
                printf("who have registered with the corresponding ");
                printf("course id: ");
                printf("The first name of the student is %s\n", st[j].f_name);
                printf("The last name of the student is %s\n", st[j].l_name);
                printf("The Roll number of the student is %d\n ", st[j].r_no);
                printf("The CGPA of the student is %f\n", st[j].cgpa);
                break;
            }
        }
    }
}

A detailed analysis of the aforementioned program or function in contrast to the methods that were previously examined:

The method " findusingcourse " is declared a way different from the first method " addstudent " but similar to the methods " findusingroll " and " findusingfname ". Because the method " addstudent "takes an input of all the details of the student irrespective of the specification and adds the information of a new student. All the process which involves entering the student details takes place in this method or function body.

However, the function " findusingroll " requires the existing student's roll number as input to retrieve and display all the student's information associated with that roll number. Similarly, the function " findusingfname " expects the first name of the student as input to showcase all the details of that specific student. Additionally, the function " findusingcourse " necessitates the course ID as input to locate the enrolled students, iterate through their details, and exhibit each student's information individually. This characteristic highlights a significant similarity among the functions " findusingfname ", " findusingroll ", and " findusingcourse ".

The starting point is set as the course ID, and each student's information is validated to identify the corresponding course ID, which is then compared with the provided input course ID. Once a match is identified, the specific details of the students enrolled in that course are displayed. This process continues until the maximum number of registered students for that course is reached. This is how the functionality of the "findusingcourse" method is executed.

5. delete:

This function is employed to remove the information of a student based on a specific roll number provided as an input. Therefore, the " delete " function accepts the roll number of the student whose information needs to be erased, and subsequently eliminates all the data associated with the student identified by the provided roll number. To grasp this idea of retrieving details through a program, let's delve into the explanation of the " delete " method.

A program showcasing the "delete" method, responsible for removing a Student's information based on their specific roll number:

Example

// method that is declared 
// to delete the student data
// by scanning the roll number
// of the student whose data 
// is supposed to be deleted

void delete()
{
    int roll;
    printf("Enter the roll number of the student ");
    printf("that you want to delete: ");
    // scanning the roll number
    // scan the roll number by using the scanf statement
    roll = 15;
    // (I've directly entered the roll number
    // to have a glance )

    // iteration being performed throughout the data
    // to find the student bearing the 
    // roll number, which is given as an input
    // using a for loop
    for(int j =0; j<= i; j++)
    {
        // checking the condition
        // for a match
        // with the given roll number
        if(roll == st[j].r_no)
        {
            for(int k = j; k < 49; k++)
            {
                st[k] = st[k + 1];
            }
            i--;
        }
    }

    printf("The details of the student ");
    printf("bearing the roll number "+roll+" are successfully ");
    printf("removed");

}

An elucidation for the aforementioned program or function and contrasting this approach with the previously analyzed methods:

The " delete " function stands out in its declaration compared to the previously mentioned methods like " addstudent ", " findusingfname ", " findusingroll ", and " findusingcourse ". Unlike the other methods, " addstudent " requires input for all student details, regardless of the specifics, to append a new student's information. The entire procedure of inputting student details occurs within the body of this particular method or function.

The function " searchbyroll " accepts the roll number of an enrolled student as input and retrieves all the student's information linked to that specific roll number. Similarly, the function " searchbyfirstname " requires the first name of a current student as input and displays all the relevant details of that particular student. Additionally, the function " searchby_course " expects the course ID, identifies the registered students, iterates through their details, and displays each student's information sequentially.

While the function "delete" is responsible for removing the records of a specific student identified by their roll number, it serves the purpose of clearing unnecessary student data from the system. The primary logic involves checking each student's roll number against the input to pinpoint the exact match for deletion. Once a matching roll number is identified, the corresponding student's details are eliminated from the database. This process continues iteratively until all relevant records are successfully removed. This elucidates the functionality of the "delete" method.

6. update:

This function is employed to modify the information of a student based on a provided roll number. Consequently, the "update" function accepts the roll number of the specific student whose data requires modification, and proceeds to update all the particulars or data associated with the student identified by the provided roll number. At times, there may be a necessity to alter only specific details rather than all of them. In such scenarios, this function remains applicable. To grasp this notion of retrieving and updating details, let's delve into a program that elaborates on the "update" function.

A program showcasing the function "update" that carries out the modification of Student information based on the assigned roll number:

Example

// method that is declared 
// to update the student data
// by scanning the roll number
// of the student whose data 
// is supposed to be updated

void update()
{
 
    int roll;
    printf("Enter the roll number of the student ");
    printf("that you want to update: ");
    
    // scanning the roll number
    
    // scan the roll number of the student 
    // by using the scanf statement
    roll = 19;
    // (I've directly entered the roll number
    // to have a glance )

    // iteration being performed throughout the data
    // to find the student bearing the 
    // roll number, which is given as an input
    
    // using a for loop
    for (int j = 0; j < i; j++) 
    {
        // checking the condition
        // for a match
        // with the given roll number
        if (st[j].r_no == roll) 
        {
            printf("Enter the number ");
            printf("for which details you want to update: ");
            printf("1. First name of the student\n");
            printf("2. Last name of the student\n");
            printf("3. Roll number of the student\n");
            printf("4. CGPA of the student\n");
            printf("5. Courses registered by the");
            printf(" student\n");   
            int z;
 
            // scan the number by using the scanf statement
            z = 4;
            // (I've directly entered the number
            // to have a glance )
            switch (z) 
            {
            case 1:
                printf("Enter the first name ");
                printf("that you want to update : \n");
                scanf("%s", st[j].f_name);
                break;
            case 2:
                printf("Enter the last name ");
                printf("that you want to update : \n");
                scanf("%s", st[j].l_name);
                
                break;
            case 3:
                printf("Enter the first name ");
                printf("that you want to update : \n");
                scanf("%d", &st[j].r_no);
                break;
            case 4:
                printf("Enter the new CGPA : \n");
                // scan the cgpa by using the scanf statement
                st[j].cgpa = 9.7;
                // (I've directly entered the cgpa
                // to have a glance )

                break;
            case 5:
                printf("Enter the new courses \n");
                scanf("%d %d %d", &st[j].cid[0],
                      &st[j].cid[1], &st[j].cid[2]);
                break;
            }
            printf("THE DETAILS OF THE STUDENT "); 
            printf("ARE UPDATED SUCCESSFULLY.\n");
        }
    }
}

An elucidation for the aforementioned program or function and contrasting this approach with the methods discussed earlier:

The function " update " is defined in a manner that sets it apart from the previously discussed and defined functions such as " addstudent ", " findusingfname ", " findusingroll ", " findusingcourse ", and " delete ". In contrast to other methods, " addstudent " requires input for all student details, regardless of the specifics, and appends the new student's information. The entire process of entering student details occurs within the body of this particular method or function.

The function " findusingroll " accepts the input of the roll number belonging to a current student and proceeds to retrieve and display all information linked to that roll number. Similarly, the function " findusingfname " receives the input of the first name of an existing student and showcases all details associated with that specific student. Additionally, the function " findusingcourse " requires the input of a course ID, locates the enrolled students, iterates through the details of these students, and then exhibits all their information individually. Finally, the function " delete " manages the removal of the details of a specific student identified by their roll number provided by the user.

Whereas the function " modify " handles the modification of information related to a specific student identified by their roll number provided by the user. This function ensures that the student records are current. Within this function, the existing information is substituted with the updated details, and the user is prompted to input the new information. An option is presented to the user to select the specific detail they want to update.

The initial condition is set as the roll number, and the information of each student is authenticated to identify the specific roll number that matches the input. Once a match is identified, the information of the corresponding students with the matching roll number is updated in the database. This process continues until the desired roll number is located.

For instance, if the digit 4 is chosen from the digits 1, 2, 3, 4, and 5, where 1 corresponds to modifying the "first name of the student", 2 corresponds to altering the "last name of the student", 3 corresponds to changing the roll number of the student", 4 corresponds to revising the cgpa of the student", and 5 corresponds to adjusting the courses enrolled by the student. Therefore, when the input is specified as 4, the cgpa of the student gets updated, replacing the previous cgpa with the new one. This is how the function "update" operates.

7. count:

The "count" method is utilized to display the total number of students currently in the database and also the availability for new student admissions based on the maximum capacity. It provides information on the existing student count and the potential for new admissions within the institute's student limit.

A program showcasing the "count" method to calculate the total student count and identify available vacancies based on the maximum student capacity:

Example

// method that is declared 
// to print the total number 
// of students 

void count()
{
    // initially, i is taken as
    // the total number of students
    // and the value of i is always 
    // incremented whenever a student
    // is added
    // value of i is
    // equal to the value of total
    // number of students

    // printing the value of i
    printf("The total number");
    printf(" of Students is: %d\n",i);

    printf("\n The maximum number ");
    printf("of students is 50\n");

    // as the maximum number of students is 50
    // the leftover number is calculated
    // by subtracting the value of i from 50

    printf("%d more students can be added",50-i);
    
}

An explanation for the above Program or method:

The " count " function is utilized to determine the overall count of students and display the available slots for new students. Within a prior function responsible for adding new students, a variable " i " is introduced to hold the data of the newly added students, incrementing with each iteration. Ultimately, the final value of " i " signifies the total count of student records stored in the database. Consequently, displaying the value of " i " aids in assessing the total student count. Subtracting this value of " i " from the maximum storage capacity reveals the number of vacant positions for students.

These functions or procedures play a crucial role in building the "Student Record System in C" application. The software integrates all the aforementioned methods. Now, we will proceed with creating the program.

A program that demonstrates the " Student Record System in C ":

Example

// C program that demonstrates the
// implementation of 
// Student Record System

// import all the required
// packages and libraries
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

// initiate the value of i
// to have an iteration 
// and keep track of 
// the number of students

int i = 0;

// initiate a structure
// in order to store the 
// information of student

struct student_info
{
    char f_name[50];
    char l_name[50];
    int r_no;
    float cgpa;
    int cid[10];
}st[55];

// method declared
// in order to add
// a new student
void add_student()
{
    printf("You can add the Student data now !! \n");

    // entering the first name of the student
    printf("Enter the first name of the Student: ");
    // scan the first name of the student by using the scanf statement 
    scanf("%s", st[i].f_name);
    // entering the last name of the student
    printf("Enter the last name of the Student: ");
    // scan the last name of the student by using the scanf statement
    scanf("%s", st[i].l_name);

    // entering the roll number of the student
    printf("Enter the roll number of the Student: ");
    // scan the roll number of the student by using the scanf statement
    scanf("%d", &st[i].r_no);

    // entering the CGPA of the student
    printf("Enter the CGPA that the student achieved: ");
    // scan the CGPA of the student by using the scanf statement
    scanf("%f", &st[i].cgpa);

    // entering the course id of each course to register
    printf("List of courses with their respective course ids: ");
    
    // iteration used for storing 
    // the enrolled courses of every student
    for(int j = 0; j<5; j++)
    {
        // storing the j value 
        // in the corresponding
        // course number
        scanf("%d", &st[i].cid[j]);
    }
    // increasing the value number of students 
    // by 1 after every iteration
    // as the details of the new student are entered
    i = i+1;

}

// method declared
// in order to 
// find the details of 
// the existing student
// using a roll number
void find_using_roll()
{
    int roll;
    printf("You can find the Student data ");
    printf("by entering a roll number now !! \n");

    // scanning the roll number of the student
    printf("Enter the roll number of the Student: ");
    // scan the roll number of the student by using the scanf statement
    scanf("%d", &roll);
    // in order to find the details
    // we are iterating through all the details 
    // of the students present within the data
    // using a for loop
    for (int j = 1; j <= i; j++) 
    {
 
        // If the condition denotes the situation 
        // where the roll number is found
        if (roll == st[i].r_no) 
        {
            printf("The details of the Student ");
            printf("with the roll given number are\n");

            // printing the first name of the student
            printf("The First name of the student is %s\n", st[j].f_name);
            printf("The Last name of the student is %s\n", st[j].l_name);
            printf("The CGPA of the student is %f\n", st[j].cgpa);
            
            // Printing the list of names of the courses
            // which are enrolled by the student

            // iteration used for displaying 
            // all the 3 courses 
            // that are enrolled by the student
            // using a " for " loop
        }
        for (int j = 0; j < 5; j++) 
        {
            printf("The course ID is %d\n", st[i].cid[j]);
        }
        break;
    }
}

// method that is declared 
// to scan the first name of a student
// and print all the details 
// of the respective student bearing the first name

// use the method find_using_fname() 
void find_using_fname()
{
    char name[50];
    printf("You can find the Student data ");
    printf("by entering the first name now !! \n");

    // scanning the first name of the student
    printf("Enter the first name of the Student: ");
    // scan the first name of the student by using the scanf statement
    scanf("%s", name);
    // (But I've directly entered the first name
    // in order to have a glance )
 
    // to find the details of the student,
    // we are iterating through all the details 
    // of the students present within the data

    // using a for loop
    for (int j = 0; j <= i; j++) {
 
        // If the condition denotes the situation 
        // where the first name is being searched is found

      // the strcmp() compares the given two strings
        // by comparing each character one by one
        // and if the strings are the same
        // then the function returns 0

        if (!strcmp(st[j].f_name, name)) 
        {
 
            printf("The details of the student are displayed below\n");
            printf("The First name of the student is %s\n", st[j].f_name);
            printf("The Last name of the student is %s\n", st[j].l_name);
            printf("The Roll Number of the student is %d\n ", st[j].r_no);
            printf("The CGPA of the student is %f\n", st[j].cgpa);
            
            // Printing the list of names of the courses
            // which are enrolled by the student

            // iteration used for displaying 
            // all the 3 courses 
            // that are enrolled by the student
            for (int k = 0; k < 5; k++) 
            {
                printf("The course ID is %d\n", st[j].cid[k]);
            }
           
        }
        
    }
}

// method that is declared 
// to scan the course id
// and print all the details 
// of the students who have enrolled 
// that particular course

void find_using_course()
{
    int id;
    printf("You can find the Student data ");
    printf("who have enrolled in the course. ");
    printf("Enter the course ID of the desired course: \n");
 
    // scanning the course id
    // scan the course id of by using the scanf statement
    scanf("%d",&id);

    // in order to find the details,
    // we are iterating through all the details 
    // of the students present within the data
    // with the given course id

    // using a for loop
    // and the iteration continuous 
    // until the iteration variable
    // is less than or equal to 
    // the maximum number of students
    // registered in that course
    for (int j = 0; j <= i; j++) 
    {
 
        // iteration being processed
        // in order to get the list of students
        // who have registered for the 
        // given course id
        for (int d = 0; d < 5; d++) 
        {
            // checking the condition
            // for a match
            // with the given course id
            if (id == st[j].cid[d]) 
            {
 
                printf("The details of the Students ");
                printf("who have registered with the ");
                printf("corresponding course id: \n");
                printf("The first name of the student is %s\n", st[j].f_name);
                printf("The last name of the student is %s\n", st[j].l_name);
                printf("The Roll number of the student is %d\n", st[j].r_no);
                printf("The CGPA of the student is %f\n", st[j].cgpa);
                break;
            }
        }
    }
}    

// method that is declared 
// to delete the student data
// by scanning the roll number
// of the student whose data 
// is supposed to be deleted
void delete()
{
    int roll;
    printf("Enter the roll number of the student ");
    printf("that you want to delete: ");
    // scanning the roll number
    // scan the roll number by using the scanf statement
    scanf("%d", &roll);

    // iteration being performed throughout the data
    // to find the student bearing the 
    // roll number, which is given as an input
    // using a for loop
    for(int j =0; j<= i; j++)
    {
        // checking the condition
        // for a match
        // with the given roll number
        if(roll == st[j].r_no)
        {
            for(int k = j; k < 49; k++)
            {
                st[k] = st[k + 1];
            }
            i--;
        }
    }

    printf("The details of the student ");
    printf("bearing the given roll number are successfully ");
    printf("removed");

}

// method that is declared 
// to update the student data
// by scanning the roll number
// of the student whose data 
// is supposed to be updated

void update()
{
 
    int roll;
    printf("Enter the roll number of the student ");
    printf("that you want to update: ");
    
    // scanning the roll number
    
    // scan the roll number of the student 
    // by using the scanf statement
    scanf("%d\n", &roll);

    // iteration being performed throughout the data
    // to find the student bearing the 
    // roll number, which is given as an input
    
    // using a for loop
    for (int j = 1; j <= i; j++) 
    {
        // checking the condition
        // for a match
        // with the given roll number
        if (st[j].r_no == roll) 
        {
            printf("Enter the number ");
            printf("for which details you want to update: \n");
            printf("1. First name of the student\n");
            printf("2. Last name of the student\n");
            printf("3. Roll number of the student\n");
            printf("4. CGPA of the student\n");
            printf("5. Courses registered by the student\n");
            int z;
 
            // scan the number by using the scanf statement
            scanf("%d", &z);
            switch (z) 
            {
            case 1:
                printf("Enter the first name ");
                printf("that you want to update : \n");
                scanf("%s", st[j].f_name);
                break;
            case 2:
                printf("Enter the last name ");
                printf("that you want to update : \n");
                scanf("%s", st[j].l_name);
                
                break;
            case 3:
                printf("Enter the first name ");
                printf("that you want to update : \n");
                scanf("%d", &st[j].r_no);
                break;
            case 4:
                printf("Enter the new CGPA : \n");
                // scan the cgpa by using the scanf statement
                scanf("%f", &st[j].cgpa);
                // (I've directly entered the cgpa
                // to have a glance )

                break;
            case 5:
                printf("Enter the new courses \n");
                scanf("%d%d%d%d%d", &st[j].cid[0], &st[j].cid[1], &st[j].cid[2], &st[j].cid[3], &st[j].cid[4]);
                break;
            }
            printf("The Details of the Student "); 
            printf("are updated successfully !!\n");
        }
    }
}

// method that is declared 
// to print the total number 
// of students 

void count()
{
    // initially, i is taken as
    // the total number of students
    // and the value of i is always 
    // incremented whenever a student
    // is added
    // value of i is
    // equal to the value of total
    // number of students

    // printing the value of i
    printf("The total number");
    printf(" of Students is: %d\n",i);

    printf("\nThe maximum number ");
    printf("of students is 50\n");

    // as the maximum number of students is 50
    // the leftover number is calculated
    // by subtracting the value of i from 50

    printf("%d more students can be added\n",50-i);
    
}

// initiating the main section
void main()
{
    int choice;
    while (i = 1)
    {
        // giving the possible statements 
        printf("\n\n\n1. Add the details of the student\n");
        printf("2. Find the details of the");
        printf(" student by using roll number\n");
        printf("3. Find the details of the");
        printf(" student by using first name\n");
        printf("4. Find the details of the");
        printf(" student by using course id\n");
        printf("5. Update the details of the");
        printf(" student by using roll number\n");
        printf("6. Delete the details of the");
        printf(" student by using roll number\n");
        printf("7. Find the total number ");
        printf("of students\n");
        printf("8. Exit\n");
        
        printf("Enter the choice number");
        printf(" that you want to perform: ");
        scanf("%d", &choice);
                  
        // use switch cases to
        // access the method
        switch (choice)
        {
            // to add student
            case 1:
                add_student();
                break;

            // to find student
            // using roll number
            case 2:
                find_using_roll();
                break;

            // to find student 
            // using the first name
            case 3:
                find_using_fname();
                break;
            
            // to find student
            // using course id
            case 4:
                find_using_course();
                break;
            
            // to update details
            // using roll number
            case 5:
                update();
                break;
            
            // to delete details
            // using roll number
            case 6:
                delete();
                break;
            
            // to count the total
            // number of students
            case 7:
                count();
                break;
            
            // to exit
            case 8:
                printf("Exit successful!!");
                exit(0);
                break;
            
        }

    }
}

The result of the aforementioned code for the given input:

Example

1. Add the details of the student
2. Find the details of the student by using roll number
3. Find the details of the student by using first name
4. Find the details of the student by using course id
5. Update the details of the student by using roll number
6. Delete the details of the student by using roll number
7. Find the total number of students
8. Exit
Enter the choice number that you want to perform: 1
You can add the Student data now !! 
Enter the first name of the Student: Nikhitha
Enter the last name of the Student: Manne
Enter the roll number of the Student: 21
Enter the CGPA that the student achieved: 8.95
List of courses with their respective course ids: 1
2
3
4
5



1. Add the details of the student
2. Find the details of the student by using roll number
3. Find the details of the student by using first name
4. Find the details of the student by using course id
5. Update the details of the student by using roll number
6. Delete the details of the student by using roll number
7. Find the total number of students
8. Exit
Enter the choice number that you want to perform: 2
You can find the Student data by entering a roll number now !! 
Enter the roll number of the Student: 21
The details of the Student with the roll given number are
The First name of the student is Nikhitha
The Last name of the student is Manne
The CGPA of the student is 8.950000
The course ID is 1
The course ID is 2
The course ID is 3
The course ID is 4
The course ID is 5



1. Add the details of the student
2. Find the details of the student by using roll number
3. Find the details of the student by using first name
4. Find the details of the student by using course id
5. Update the details of the student by using roll number
6. Delete the details of the student by using roll number
7. Find the total number of students
8. Exit
Enter the choice number that you want to perform: 3
You can find the Student data by entering the first name now !! 
Enter the first name of the Student: Nikhitha
The details of the student are displayed below
The First name of the student is Nikhitha
The Last name of the student is Manne
The Roll Number of the student is 21
 The CGPA of the student is 8.950000
The course ID is 1
The course ID is 2
The course ID is 3
The course ID is 4
The course ID is 5



1. Add the details of the student
2. Find the details of the student by using roll number
3. Find the details of the student by using first name
4. Find the details of the student by using course id
5. Update the details of the student by using roll number
6. Delete the details of the student by using roll number
7. Find the total number of students
8. Exit
Enter the choice number that you want to perform: 3
You can find the Student data by entering the first name now !! 
Enter the first name of the Student: Nikhitha
The details of the student are displayed below
The First name of the student is Nikhitha
The Last name of the student is Manne
The Roll Number of the student is 21
 The CGPA of the student is 8.950000
The course ID is 1
The course ID is 2
The course ID is 3
The course ID is 4
The course ID is 5



1. Add the details of the student
2. Find the details of the student by using roll number
3. Find the details of the student by using first name
4. Find the details of the student by using course id
5. Update the details of the student by using roll number
6. Delete the details of the student by using roll number
7. Find the total number of students
8. Exit
Enter the choice number that you want to perform: 4
You can find the Student data who have enrolled in the course. Enter the course ID of the desired course: 
1
The details of the Students who have registered with the corresponding course id: 
The first name of the student is Nikhitha
The last name of the student is Manne
The Roll number of the student is 21
The CGPA of the student is 8.950000



1. Add the details of the student
2. Find the details of the student by using roll number
3. Find the details of the student by using first name
4. Find the details of the student by using course id
5. Update the details of the student by using roll number
6. Delete the details of the student by using roll number
7. Find the total number of students
8. Exit
Enter the choice number that you want to perform: 5
Enter the roll number of the student that you want to update: 21
Enter the number for which details you want to update: 
1. First name of the student
2. Last name of the student
3. Roll number of the student
4. CGPA of the student
5. Courses registered by the student
1
Enter the first name that you want to update : 
Nikki
The Details of the Student are updated successfully !!



1. Add the details of the student
2. Find the details of the student by using roll number
3. Find the details of the student by using first name
4. Find the details of the student by using course id
5. Update the details of the student by using roll number
6. Delete the details of the student by using roll number
7. Find the total number of students
8. Exit
Enter the choice number that you want to perform: 7
The total number of Students is: 1

The maximum number of students is 50
49 more students can be added



1. Add the details of the student
2. Find the details of the student by using roll number
3. Find the details of the student by using first name
4. Find the details of the student by using course id
5. Update the details of the student by using roll number
6. Delete the details of the student by using roll number
7. Find the total number of students
8. Exit
Enter the choice number that you want to perform: 6
Enter the roll number of the student that you want to delete: 21
The details of the student bearing the given roll number are successfully removed


1. Add the details of the student
2. Find the details of the student by using roll number
3. Find the details of the student by using first name
4. Find the details of the student by using course id
5. Update the details of the student by using roll number
6. Delete the details of the student by using roll number
7. Find the total number of students
8. Exit
Enter the choice number that you want to perform: 2
You can find the Student data by entering a roll number now !! 
Enter the roll number of the Student: 21
The course ID is 0
The course ID is 0
The course ID is 0
The course ID is 0
The course ID is 0



1. Add the details of the student
2. Find the details of the student by using roll number
3. Find the details of the student by using first name
4. Find the details of the student by using course id
5. Update the details of the student by using roll number
6. Delete the details of the student by using roll number
7. Find the total number of students
8. Exit
Enter the choice number that you want to perform: 8
Exit successful!!

An elucidation for the aforementioned Program and its associated result:

For the above program, all the possible inputs are given one by one after receiving the previous outputs. The options are given with their respective serial numbers so that one of those can be chosen by the user through the input. The options with their respective numbers are:

  • Add the details of the student
  • Find the details of the student by using roll number
  • Find the details of the student by using first name
  • Find the details of the student by using course id
  • Update the details of the student by using roll number
  • Delete the details of the student by using roll number
  • Find the total number of students
  • Exit

So, the individual will need to select the preferred action from the operations provided above, and the chosen operation will be executed. If the initial choice, specifically "include the information of the learner," is selected, it allows for the addition of a new student's information. Opting for the second choice, "retrieve the information of the learner by roll number," enables accessing the details of an existing student using their roll number. Alternatively, selecting the third option, "retrieve the information of the learner by first name," facilitates finding the details of an existing student based on their first name.

If the fourth choice, specifically "Retrieve student information through course ID," is selected, you can access the details of a student already enrolled in a course by their corresponding course ID. Opting for the fifth option, "Modify student details via roll number," allows you to update the information of an existing student by inputting their unique roll number. Alternatively, by selecting the sixth option, "Erase student details based on roll number," you can remove the information of a student from the database using their individual roll number. In the event that the seventh option, "Retrieve total student count," is chosen, you will receive the total count of students currently registered. Finally, by choosing the eighth option, "Exit," you will gracefully exit the terminal session.

Initially, the necessary functions and methods are defined to enable access and execution of these tasks as needed. This process facilitates the establishment of a database system responsible for storing and safeguarding student information.

Input Required

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