College Management System

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

COLLEGE MANAGEMENT

SYSTEM
Under Supervision of/ Dr. Zakaria Abdeltawab

DEPARTMENT/MECHATRONICS

Team Members:-
1-Youssef Mahmoud Ahmed
2- Omar Basem AbdelSalam
3-Ali Mohammed Mohammed
4- Nejm Mohammed
5- AbdelAziz Hazem
6- Mohammed Wasim
7- Mohamed Ahmed Said
Introduction
The College Management System is a simple C program designed to store and
retrieve information about students. The program uses structures to represent
student records and offers options to search for students based on their seat
number or name.

Code Overview

1. Structure Definition: -

• Include Header (#include <string.h>):

This line includes the header file <string.h>, which provides functions for
manipulating strings.
• Define Structure (struct Students):

This code defines a structure named Students. A structure is a user-defined data


type in C that allows bundling different types of data under a single name.
• Structure Members:
• Inside the structure:
char name[50];: Member to store the student's name. It's an array of characters
with a maximum length of 50.
char degree[50];: Member to store the student's degree. It's an array of characters
with a maximum length of 50.
char city[50];: Member to store the student's city. It's an array of characters with a
maximum length of 50.
int age;: Member to store the student's age. It's an integer data type.
double seat_num;: Member to store the student's seat number. It's a double-
precision floating-point data type.
• Instance Creation:

Following the structure definition, instances of the structure are created:


student_1, student_2, ..., student_7.
Each instance represents an individual student and has the structure's members
to store specific information.

2. Data Initialization: -
• strcpy Function:

The strcpy function is used to copy strings. It copies the content of the specified
string ("Youssef Mahmoud", "Very Good", etc.) into the corresponding name and
degree members of each student.
• Assigning Values:

For each student (student_1 to student_7), you assign values to their respective
members:
name: The name of the student.
degree: The degree achieved by the student.
age: The age of the student.
seat_num: The seat number of the student.
This part of the code initializes the information for each student.

3. Search or Choice Mechanism: -

These Variables are declared to manage user input during the search process.
4. Searching by Student Number in List: -

• Infinite Loop (while (1)):

The code initiates an infinite loop, ensuring continuous interaction until explicitly
broken.
• User Prompt (printf and scanf):

The program prompts the user to enter the search type, specifically whether they
want to search by student number or name.
The user's choice is stored in the search variable.

• Searching by Student Number (if (search == 1)):


If the user chooses to search by student number (1), the console screen is cleared
(system("cls")) for a cleaner display.
The user is prompted to enter the student number (studentNum).
A series of if conditions compares the entered student number with predefined
values (e.g., 11 for student_1).
If a match is found (e.g., studentNum == 11), details for that student are displayed
on the console.
The displayed details include the student's name, grade, city, age, and seat
number, formatted for clarity.
Similar conditions and displays are created for other students, ensuring
comprehensive information is accessible.

5. Searching by Student Name: -


Search by Student Name (else if (search == 2))
If the user chooses to search by student name (2), the console screen is cleared by
(system("cls")) for a cleaner display.
The user is prompted to enter the student name (enter). The format requires the
first letters to be capitalized.
The scanf format specifier %99[^\n] allows the input of strings with spaces.
The entered name is compared using strcmp with the names of each predefined
student.
If a match is found (e.g., strcmp(enter, student_1.name) == 0), details for that
student are displayed on the console.
The displayed details include the student's name, grade, city, age, and seat
number, formatted for clarity.
Similar conditions and displays are created for other students, ensuring
comprehensive information is accessible.

6. User Interaction
• User Prompt (printf and scanf):

The user is prompted with the question, "Do you want to perform another
operation? (y/n): ".
The user's response is stored in the variable quit.

• Check User's Choice (if-else Statements):

The program checks the user's choice:


If the user chooses not to perform another operation ('n'):
The console screen is cleared (system("cls")) for the final message.
A thank you message is displayed (printf("Thanks for using our program\n")).
The break statement is used to exit the infinite loop and end the program.
If the user chooses to continue ('y'):
The console screen is cleared for the next operation.
If the user provides an invalid choice:
An error message is displayed (printf("Error: Invalid Choice\n")).
The break statement is used to exit the infinite loop in case of an error.

• Exit the Program (return 0):

The return 0; statement is used to gracefully exit the program with a status code
of 0.
A status code of 0 typically indicates a successful execution.
Output on Console
Benefits of the Code

Modularity: The use of structures enhances code modularity, making it easier to


manage and expand.
User-Friendly Interface: The program provides clear options and instructions for
users, ensuring a smooth interaction.
Structured Data: Organizing student data in a structured manner simplifies
retrieval and manipulation.

Areas for Improvement

Error Handling: Consider enhancing error handling mechanisms to address


potential user input errors.
Dynamic Data: For scalability, explore options to dynamically manage student
data, allowing for an indefinite number of records.
Optimization: Evaluate the code for potential optimizations to enhance efficiency.
Conclusion

The C code establishes a robust system for managing student information.


Through structures, it encapsulates essential data, providing a foundation for
flexible expansion.
The user interface offers a seamless experience for searching and retrieving
student details.

You might also like