Skip to content

sai21-learn/srms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Student Record Management System

A simple console-based Student Record Management System written in C. This application provides a straightforward interface for managing student records with essential features like adding, displaying, searching, modifying, deleting, and sorting records. All data is persisted using binary file handling.

πŸ“‹ Table of Contents

✨ Features

  • Add Student: Add new student records with ID, Name, Branch, Year, Semester, and CGPA with automatic ID validation
  • Display Students: View all stored student records in a tabular format
  • Search Student: Find a specific student by their ID
  • Modify Student: Update details (Name, Branch, Semester, CGPA) of an existing student
  • Delete Student: Remove a student record permanently from the database
  • Sort Students: Sort all records by ID in ascending order
  • Data Persistence: All records are saved to students.dat and loaded automatically
  • Input Validation: Comprehensive validation for student IDs based on year of study
  • Duplicate Prevention: System prevents adding duplicate student IDs

πŸ”§ Prerequisites

  • C Compiler: GCC (GNU Compiler Collection) or any compatible C compiler
    • Windows: MinGW, MSYS2, or Visual Studio with C/C++ support
    • Linux: Usually pre-installed (sudo apt-get install gcc on Ubuntu/Debian)
    • macOS: Xcode Command Line Tools (xcode-select --install)
  • Operating System: Windows, Linux, or macOS
  • Terminal/Command Prompt: For running the application

πŸ“ File Structure

STUDENT RECORD MANAGEMENT SYSTEM/
β”‚
β”œβ”€β”€ main.c              # Main program entry point and menu loop
β”œβ”€β”€ student.c           # Core functionality (CRUD operations, File I/O)
β”œβ”€β”€ student.h           # Student structure and function prototypes
β”œβ”€β”€ students.dat        # Binary data file (auto-generated)
β”œβ”€β”€ student_system.exe  # Compiled executable (Windows)
└── README.md           # This file

File Descriptions

  • main.c: Contains the main menu loop, user input handling, and program flow control
  • student.c: Implements all core functionality including:
    • Adding students with validation
    • Displaying all students
    • Searching for students
    • Modifying student records
    • Deleting students
    • Sorting student records
  • student.h: Defines the Student structure and function prototypes
  • students.dat: Binary file storing all student records (created automatically)

πŸš€ Installation

  1. Clone or Download the project to your local machine
  2. Navigate to the project directory using terminal/command prompt
  3. Ensure you have a C compiler installed (see Prerequisites)

πŸ”¨ Compilation

Windows

Open Command Prompt or PowerShell in the project directory and run:

gcc main.c student.c -o student_system.exe

Linux/macOS

Open Terminal in the project directory and run:

gcc main.c student.c -o student_system

Compilation Options

For optimized builds, you can use:

gcc -Wall -O2 main.c student.c -o student_system
  • -Wall: Enable all compiler warnings
  • -O2: Enable optimization level 2

▢️ How to Run

Windows

student_system.exe

Linux/macOS

./student_system

πŸ“– Usage

  1. Launch the Application: Run the compiled executable from the command line
  2. View Menu: The main menu will display with the following options:
    • 1: Add a new student
    • 2: Display all students
    • 3: Search for a student
    • 4: Modify a student record
    • 5: Delete a student
    • 6: Sort all students by ID
    • 0: Exit the application
  3. Select Operation: Enter the number (0-6) corresponding to your desired action
  4. Follow Prompts: Enter the required information as prompted by the program
  5. Return to Menu: After completing an operation, you'll automatically return to the main menu
  6. Exit: Select option 0 to exit the application

Example Workflow

Adding a Student:

Select option 1
β†’ Enter Year of Study (1-4): 2
β†’ Enter Branch (e.g., CSE, ECE): CSE
β†’ Enter Semester: 3
β†’ Enter ID (Must start with AP24): AP24CS001
β†’ Enter Name: John Doe
β†’ Enter CGPA: 8.5
β†’ Student added successfully!

Displaying All Students:

Select option 2
β†’ View table showing all student records with columns:
  ID, Name, Branch, Year, Sem, CGPA

Searching for a Student:

Select option 3
β†’ Enter ID to search: AP24CS001
β†’ View detailed information about the student

πŸ†” Student ID Validation

The system automatically validates student IDs based on the year of study to ensure data consistency:

Year of Study Required ID Prefix
1st Year AP25
2nd Year AP24
3rd Year AP23
4th Year AP22

Validation Rules:

  • βœ… Student ID must start with the correct prefix for the selected year
  • βœ… Duplicate IDs are not allowed - the system checks for existing IDs
  • βœ… If validation fails, the system will prompt you to re-enter the ID
  • βœ… IDs are case-sensitive

Examples:

  • 1st Year Student: ID must start with AP25 (e.g., AP25CS001, AP25ECE002)
  • 2nd Year Student: ID must start with AP24 (e.g., AP24CS001, AP24ME003)
  • 3rd Year Student: ID must start with AP23 (e.g., AP23CS001)
  • 4th Year Student: ID must start with AP22 (e.g., AP22CS001)

πŸ’Ύ Data Storage

File Information

  • File Name: students.dat
  • File Format: Binary format for efficient storage
  • Storage Location: Created automatically in the same directory as the executable
  • File Creation: The file is created automatically when you add the first student

Data Structure

Each student record contains the following fields:

  • Student ID: Maximum 15 characters (e.g., AP24CS001)
  • Name: Maximum 50 characters
  • Branch: Maximum 10 characters (e.g., CSE, ECE, ME)
  • Year of Study: Integer (1-4)
  • Semester: Integer
  • CGPA: Floating-point number (e.g., 8.5, 9.2)

Data Persistence

  • βœ… All data is automatically saved immediately after each operation
  • βœ… Data persists between program runs - no need to save manually
  • βœ… The file remains intact even after closing the program

Backup Recommendation

⚠️ Important: Consider backing up students.dat regularly to prevent data loss. You can simply copy the file to a safe location.

πŸ› Troubleshooting

Compilation Errors

Error: undefined reference to 'function_name'

  • Solution: Ensure all source files are included in the compilation command:
    gcc main.c student.c -o student_system

Error: cannot find -lm or similar linker errors

  • Solution: This is usually not needed for this project. If it occurs, try:
    gcc main.c student.c -o student_system -lm

Error: Permission denied when compiling

  • Solution: Close any running instances of the program, or compile with a different output name

Runtime Issues

Program exits immediately or closes right away

  • Solution: Always run the program from command prompt/terminal, not by double-clicking the executable
  • Windows: Open Command Prompt or PowerShell, navigate to the folder, then run student_system.exe
  • Linux/macOS: Open Terminal, navigate to the folder, then run ./student_system

File permission errors

  • Solution: Ensure you have read/write permissions in the program directory
  • Windows: Run Command Prompt as Administrator if needed
  • Linux/macOS: Check file permissions with ls -l and use chmod if necessary

Data not persisting or file not found

  • Solution:
    • Check if students.dat exists in the same directory as the executable
    • Ensure the program has write permissions in the directory
    • Try running the program from the directory where it was compiled

Invalid input causes program to hang

  • Solution: The program handles most input errors, but if it hangs, press Ctrl+C to exit and restart

πŸ“Š Project Structure

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            main.c                        β”‚
β”‚  - Program entry point                   β”‚
β”‚  - Menu loop                             β”‚
β”‚  - User input handling                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
               β”œβ”€β”€β–Ί student.h (includes)
               β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          student.c                       β”‚
β”‚  - addStudent()                          β”‚
β”‚  - displayStudents()                     β”‚
β”‚  - searchStudent()                       β”‚
β”‚  - modifyStudent()                       β”‚
β”‚  - deleteStudent()                       β”‚
β”‚  - sortStudents()                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
               └──► students.dat (file I/O)

πŸ“ Important Notes

  • File I/O: The program uses binary file I/O for efficient data storage and fast access
  • Case Sensitivity: Student IDs are case-sensitive (e.g., AP24CS001 β‰  ap24cs001)
  • CGPA Format: CGPA values are stored as floating-point numbers (supports decimals like 8.5, 9.75)
  • Sorting: The sort function sorts all students by ID in ascending alphabetical order
  • Input Validation: All input validation is handled automatically - invalid inputs will prompt for re-entry
  • No Manual Save: Data is saved automatically after each operation - no save button needed
  • Year Restrictions: Year of Study must be between 1 and 4 (inclusive)
  • Duplicate Prevention: The system automatically prevents adding duplicate student IDs

πŸ”„ Future Enhancements

Potential improvements for future versions:

  • πŸ“Š Export data to CSV/Excel format for external analysis
  • πŸ“₯ Import data from external files (CSV, text files)
  • πŸ” Advanced search functionality (search by name, branch, CGPA range, etc.)
  • πŸ“ˆ Statistics and analytics (average CGPA, branch-wise statistics)
  • πŸ” Password protection for data security
  • πŸ‘₯ Multi-user support with user authentication
  • πŸ’Ύ Built-in data backup and restore functionality
  • πŸ“‹ Generate reports and transcripts
  • 🎨 Enhanced user interface with better formatting
  • πŸ”„ Undo/Redo functionality for operations

πŸ‘¨β€πŸ’» Development

Code Structure

  • Modular Design: Code is organized into separate files for maintainability
  • Clear Naming: Functions and variables follow clear naming conventions
  • Documentation: Key functions include comments for clarity
  • Error Handling: Input validation and error checking throughout

Adding New Features

To add a new feature to the system:

  1. Add Function Prototype: Add the function declaration to student.h
  2. Implement Function: Write the function implementation in student.c
  3. Add Menu Option: Add a new case in the switch statement in main.c
  4. Update Menu: Add the new option to the menu display in main.c
  5. Test: Test the new feature thoroughly
  6. Document: Update this README if the feature changes usage instructions

πŸ“„ License

This project is open source and available for educational purposes.

🀝 Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.


πŸ“ž Support

If you encounter any issues or have questions:

  1. Check the Troubleshooting section above
  2. Review the code comments for implementation details
  3. Ensure all prerequisites are met

πŸ“„ License

This project is open source and available for educational purposes. Feel free to use, modify, and distribute as needed.


Version: 1.0
Last Updated: 2024
Language: C (C99 Standard)
Platform: Windows, Linux, macOS
License: Open Source (Educational Use)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages