Skip to content

Safin313-stack/Project-C-Student-Marks-Management

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation



C Platform Compiler Editor MIT License


View Source
✦ Click above to view the full source code on GitHub ✦




🎓 Features

➕ Add Student 📋 Display All 🏆 Find Topper 📊 Auto Totals 📈 Averages 🚪 Exit
Add student name and marks for 3 subjects Display all students in a formatted table Automatically find and display the top scorer Auto-calculate total marks per student Auto-calculate average marks per student Graceful exit with goodbye message

🖥️ Terminal Preview

=== Student Marks Management ===
1. Add Student
2. Display All Students
3. Find Topper
4. Exit
Choose an option (1-4): 1

Enter student name: safin
Enter marks for subject 1 : 12
Enter marks for subject 2 : 12
Enter marks for subject 3 : 12
Student 'safin' added successfully!

=== Student Marks Management ===
Choose an option (1-4): 2

Name       Marks (Sub1 Sub2 Sub3)   Total    Average
----------------------------------------------------
safin      12   12   12   Total: 36  Average: 12.00

=== Student Marks Management ===
Choose an option (1-4): 4
Goodbye! Exiting program.

🧠 How It Works

Struct-based Student Records

struct Student {
    char  name[50];
    float marks[3];      // marks for 3 subjects
    float total;
    float average;
};

Add Student with Auto Calculation

void addStudent(struct Student s[], int *count) {
    printf("Enter student name: ");
    scanf("%s", s[*count].name);

    float total = 0;
    for (int i = 0; i < 3; i++) {
        printf("Enter marks for subject %d : ", i + 1);
        scanf("%f", &s[*count].marks[i]);
        total += s[*count].marks[i];
    }

    s[*count].total   = total;
    s[*count].average = total / 3.0;
    (*count)++;
    printf("Student '%s' added successfully!\n", s[*count - 1].name);
}

Display All Students in Formatted Table

void displayAll(struct Student s[], int count) {
    printf("%-10s  Marks (Sub1 Sub2 Sub3)   Total    Average\n", "Name");
    printf("----------------------------------------------------\n");
    for (int i = 0; i < count; i++) {
        printf("%-10s  %.0f   %.0f   %.0f   Total: %.0f  Average: %.2f\n",
            s[i].name,
            s[i].marks[0], s[i].marks[1], s[i].marks[2],
            s[i].total, s[i].average);
    }
}

Find Topper

void findTopper(struct Student s[], int count) {
    int top = 0;
    for (int i = 1; i < count; i++) {
        if (s[i].total > s[top].total)
            top = i;
    }
    printf("Topper: %s with Total: %.0f  Average: %.2f\n",
        s[top].name, s[top].total, s[top].average);
}

🛠️ Compile and Run

Prerequisites

  • Linux OS
  • GCC installed
# Check GCC
gcc --version

# Install if needed (Ubuntu/Debian)
sudo apt install gcc

Compile

gcc -o student_marks "(PROJECT)_Student_Marks_Management_System.c" -lm

⚠️ The -lm flag links the math library — required for average calculations

Run

./student_marks

One-liner

gcc -o student_marks "(PROJECT)_Student_Marks_Management_System.c" -lm && ./student_marks

📁 Project Structure

Project-C-Student-Marks-Management/
│
├── 📄 (PROJECT)_Student_Marks_Management_System.c   ← Full source code
└── 📄 README.md                                     ← Project documentation

🛠️ Tech Stack

┌──────────────────────────────────────────────────┐
│              C Console Application               │
├─────────────────┬────────────────────────────────┤
│  Language       │  C (C99 standard)              │
│  Compiler       │  GCC with -lm flag (Linux)     │
│  Editor         │  VS Code                       │
│  Libraries      │  stdio.h · stdlib.h · math.h   │
│  Platform       │  Linux                         │
└─────────────────┴────────────────────────────────┘

📚 Key Concepts Used

struct           → custom data type for Student records
arrays           → store marks for 3 subjects per student
for loop         → iterate over students and subjects
printf %-10s     → left-aligned formatted table output
total / 3.0      → calculate average marks
linear search    → find topper by comparing totals
scanf/printf     → console input and output
-lm flag         → link math library at compile time

👤 Developer


Saharia Hassan Safin C Developer · Front-end Developer


GitHub   Source Code


"Every student deserves a topper finder built just for them" 🎓



MIT License · © 2025 Saharia Hassan Safin · ⭐ Star this repo if it helped you!

About

A terminal-based student marks management system in C with topper finder

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages