Project Of Student Record System in ‘C’ Language – Download Free PDF
Unlike other mini projects published in Code with C, this mini project in C Student Record System has a unique style of coding and is presented in a colorful manner. It uses files as database to perform file handling operations such as add, search, modify and delete records to manage students’ records. In this project, you can also generate mark-sheet for students.
AUTHOR: UNKNOWN
SIZE OF FILE: UNKNOWN
NUMBER OF PAGES:UNKNOWN
LANGUAGE: ENGLISH
CATEGORY : C LANGUAGE PROJECT
PAGE QUALITY: GOOD
Project Of Student Record System in ‘C’ Language Download Link
I can help you create a Student Record System in C. Below is a simple C program that allows adding, displaying, searching, and deleting student records. If you want a PDF version, you can copy this and save it as a PDF.
Contents
Features of the Student Record System:
✔ Add Student Records
✔ Display All Records
✔ Search for a Student
✔ Delete a Student Record
C Program: Student Record System
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Student {
int roll_no;
char name[50];
float marks;
};
void addStudent();
void displayStudents();
void searchStudent();
void deleteStudent();
FILE *fp;
int main() {
int choice;
while (1) {
printf("\n===== Student Record System =====\n");
printf("1. Add Student\n");
printf("2. Display Students\n");
printf("3. Search Student\n");
printf("4. Delete Student\n");
printf("5. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice) {
case 1: addStudent(); break;
case 2: displayStudents(); break;
case 3: searchStudent(); break;
case 4: deleteStudent(); break;
case 5: exit(0);
default: printf("Invalid choice! Try again.\n");
}
}
return 0;
}
void addStudent() {
struct Student s;
fp = fopen("students.dat", "ab");
if (!fp) {
printf("Error opening file!\n");
return;
}
printf("Enter Roll No: ");
scanf("%d", &s.roll_no);
printf("Enter Name: ");
scanf(" %[^\n]", s.name);
printf("Enter Marks: ");
scanf("%f", &s.marks);
fwrite(&s, sizeof(struct Student), 1, fp);
fclose(fp);
printf("Student record added successfully!\n");
}
void displayStudents() {
struct Student s;
fp = fopen("students.dat", "rb");
if (!fp) {
printf("No records found!\n");
return;
}
printf("\nRoll No\tName\tMarks\n");
while (fread(&s, sizeof(struct Student), 1, fp)) {
printf("%d\t%s\t%.2f\n", s.roll_no, s.name, s.marks);
}
fclose(fp);
}
void searchStudent() {
struct Student s;
int roll, found = 0;
fp = fopen("students.dat", "rb");
if (!fp) {
printf("No records found!\n");
return;
}
printf("Enter Roll No to search: ");
scanf("%d", &roll);
while (fread(&s, sizeof(struct Student), 1, fp)) {
if (s.roll_no == roll) {
printf("\nStudent Found!\nRoll No: %d\nName: %s\nMarks: %.2f\n", s.roll_no, s.name, s.marks);
found = 1;
break;
}
}
fclose(fp);
if (!found) {
printf("Student not found!\n");
}
}
void deleteStudent() {
struct Student s;
int roll, found = 0;
FILE *temp;
fp = fopen("students.dat", "rb");
if (!fp) {
printf("No records found!\n");
return;
}
temp = fopen("temp.dat", "wb");
printf("Enter Roll No to delete: ");
scanf("%d", &roll);
while (fread(&s, sizeof(struct Student), 1, fp)) {
if (s.roll_no == roll) {
printf("Student record deleted successfully!\n");
found = 1;
} else {
fwrite(&s, sizeof(struct Student), 1, temp);
}
}
fclose(fp);
fclose(temp);
remove("students.dat");
rename("temp.dat", "students.dat");
if (!found) {
printf("Student not found!\n");
}
}
How to Run the Program
- Copy and paste the code into a C compiler (like Dev-C++, Turbo C, Code::Blocks, or GCC).
- Compile and run the program.
- Follow the menu options to add, display, search, and delete student records.
Need a PDF?
If you need a PDF version, I can generate one for you. Let me know!