Simple Result System in C
Simple Result System in C
A PROJECT REPORT
ON
SUBMITED TO
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
INPARTIAL FULFILLMENT OF THE REQUIRMENTS FOR THE AWARD OF
DIPLOMA IN COMPUTER ENGNEERING
BY
1. Mahadev Sakhare
2.Tejas Suryavanshi
3.Sanket Sutar
1
RAJARAMBAPU INSTITUTE OF
TECHNOLOGY’S(POLETECHNIC)LOHEGAON PUNE -411047
CERTIFICATE
2
RAJARAMBAPU INSTITUTE OF
TECHNOLOGY’S(POLETECHNIC)LOHEGAON PUNE -411047
CERTIFICATE
3
RAJARAMBAPU INSTITUTE OF
TECHNOLOGY’S(POLETECHNIC)LOHEGAON PUNE -411047
CERTIFICATE
4
ACKNOWLEDGEMENT
5
ABSTRACT
6
INDEX
7
INTRODUCTION
Objective of Project The objective of the project is to create a Student Result System to store the
Name, Roll no., Marks of different student using a linear data structure using C programming. In
this software one can very easily add student’s record, sort student’s record, search student’s
record, compute (using algorithms) and view all student’s records. This application stand out
among all other software in a way that it is user friendly and can be modified easily as per the
requirements. It allows user to add new/view/sort/search records.
8
BASIC CONCEPT
9
Source Code
#include<stdio.h>
#include<conio.h>
#include<process.h>
struct student
{
int rollno;
char name[50];
int p_marks,c_marks,m_marks,e_marks,cs_marks;
float per;
char grade;
int std;
}
st;
FILE *fptr;
void write_student()
{fptr=fopen("student.dat","ab");
printf("\n please enter the new details of student\n");
printf("\n enter the roll no of student");
scanf("%d",&st.rollno);
fflush(stdin);
printf("\n\nenter the name of student");
gets(st.name);
printf("\n enter the marks in physics out of100:");
scanf("%d",&st.p_marks);
10
printf("\n enter the marks in chemistry out of 100:");
scanf("%d",&st.c_marks);
printf("\n enter the marks in maths out of 100:");
scanf("%d",&st.m_marks);
printf("\n enter the marks in english out of 100:");
scanf("%d",&st.e_marks);
printf("\n enter the marks in computer science out of 100:");
scanf("%d",&st.cs_marks);
st.per=(st.p_marks+st.c_marks+st.m_marks+st.e_marks+st.cs_marks)/5.0;
if(st.per>=60)
st.grade='a';
else if(st.per>=50 &&st.per<60)
st.grade='b';
else if(st.per>=33 &&st.per<50)
st.grade='c';
else
st.grade='f';
fwrite(&st,sizeof(st),1,fptr);
fclose(fptr);
printf("\n\n student record has been created");
getch();
}
void display_all()
{ clrscr();
printf("/n/n/n/t/t display all record!!!/n/n");
fptr=fopen("student.dat","rb");
while ((fread(&st,sizeof(st),1,fptr))>0)
11
{
printf("\nroll number of student:%d",st.rollno);
printf("\nname of student:%s",st.name);
printf("\nmarks in physics:%d",st.p_marks);
printf("\nmarks in chemistry:%d",st.c_marks);
printf("\nmarks in maths:%d",st.m_marks);
printf("\nmarks in english:%d",st.e_marks);
printf("\nmarks in computer science:%d",st.cs_marks);
printf("\npercentage of student is : %.2f",st.per);
printf("\n grade of student is : %c",st.grade);
printf("\n\n================================================\n");
getch();
}
fclose(fptr);
getch();
}
void display_sp(int n)
{int flag=0;
fptr=fopen("student.dat","rb");
while ((fread(&st,sizeof(st),1,fptr))>0)
{if(st.rollno==n)
{ clrscr();
printf("\nroll number of student: %d",st.rollno);
printf("\n name of the student : %s",st.name);
printf("\n marks in physics : %d",st.p_marks);
printf("\n marks in chemistry : %d",st.c_marks);
12
printf("\n marks in maths : %d",st.m_marks);
printf("\n marks in english : %d",st.e_marks);
printf("\n marks in computer science: %d",st.cs_marks);
printf("\n percentage of student is : %.2f",st.per);
printf("\n grade of student is : %c",st.grade);
flag=1;
}
}
fclose(fptr);
if (flag==0)
printf("\n\n record not exist");
getch();
}
void modify_student()
{int no,found=0;
clrscr();
printf("\n\n\t to modify");
printf("\n\n\t please enter the roll no of student");
scanf("%d",&no);
fptr=fopen("student.dat","rb+");
while((fread(&st,sizeof(st),1,fptr))>0 && found==0)
{
if(st.rollno==no)
{printf("\n roll no of student: %d",st.rollno);
printf("\n\n name of student : %s",st.name);
printf("\n marks in physics : %d",st.p_marks);
printf("\n marks in chemistry : %d",st.c_marks);
13
printf("\n marks in maths : %d",st.m_marks);
printf("\n marks in english : %d",st.e_marks);
printf("\n marks in computer science : %d",st.cs_marks);
printf("\n percentage of student is: %.2f",st.per);
printf("\n grade of student is : %c",st.grade);
printf("\n please enter the new details of student\n");
printf("\n enter the roll no of student");
scanf("%d",&st.rollno);
fflush(stdin);
printf("\n\n enter the name of student");
gets(st.name);
printf("\n enter the marks in physics out of 100:");
scanf("%d",&st.p_marks);
printf("\n enter the marks in chemistyr out of 100:");
scanf("%d",&st.c_marks);
printf("\n enter the marks in maths out of 100:");
scanf("%d",&st.m_marks);
printf("\n enter the marks in english out of 100:");
scanf("%d",&st.e_marks);
printf("\n enter the marks in computer science out of 100:");
scanf("%d",&st.cs_marks);
st.per=(st.p_marks+st.c_marks+st.m_marks+st.e_marks+st.cs_marks)/5.0;
if(st.per>=60)
st.grade='a';
else if(st.per>=50 && st.per<60)
st.grade='b';
else if(st.per>=33 && st.per<50)
14
st.grade='c';
else st.grade='f';
fseek(fptr,-(long)sizeof(st),1);
fwrite(&st,sizeof(st),1,fptr);
printf("\n\n\t record updated");
found=1;
}
}
fclose(fptr);
if(found==0)
printf("\n\n record not found");
getch();
}
void delete_student()
{int no;
FILE *fptr2;
clrscr();
printf("\n\n\n\t delete record");
printf("\n\n please enter the roll no of student you want to delete");
scanf("%d",&no);
fptr=fopen("student.dat","rb");
fptr2=fopen("temp.dat","wb");
rewind(fptr);
while((fread(&st,sizeof(st),1,fptr))>0)
{
if(st.rollno!=no)
{fwrite(&st,sizeof(st),1,fptr2);
15
}
}
fclose(fptr2);
fclose(fptr);
remove("student.dat");
rename("temp.dat","student.dat");
printf("\n\n\t record deleted..");
getch();
}
void class_result()
{clrscr();
fptr=fopen("student.dat","rb");
if(fptr==NULL)
{
printf("ERROR!!! FILE COULD NOT BE OPEN\n\n\n go to entry menu to creat file");
printf("\n\n\n program is closing....");
getch();
exit(0);
}
printf("\n\n\t\t ALL STUDENT RESULT \n\n");
printf("==============================================================
====\n");
printf("R.NO. Name P C M E CS %age Grade\n");
printf("==============================================================
====\n");
while((fread(&st,sizeof(st),1,fptr))>0)
{
16
printf("%-6d %-10s %-3d %-3d %-3d %-3d %-3d %-3.2f %-1c\n",st.rollno,st.name,
st.p_marks,st.c_marks,st.m_marks,st.e_marks,st.cs_marks,st.per,st.grade);
}
fclose(fptr);
getch();
}
void result()
{int ans,rno;
char ch;
clrscr();
printf("\n\n\n result menu");
printf("\n\n\n1.class result\n\n2.student report card \n\n3.back to main menu");
printf("\n\n\n enter choice(1/2)?");
scanf("%d",&ans);
switch(ans)
{
case1 : class_result();
break;
case2 :{
do{
char ans;
clrscr();
printf("\n\n enter roll no of student :");
scanf("%d",&rno);
display_sp(rno);
printf("\n\n do you want to see more result(y/n)?");
scanf("%c",&ans);
17
} while(ans=='y' ||ans=='Y');
break;
case3 : break;
default: printf("\a");
}
}
{
clrscr();
gotoxy(35,11);
printf("student");
gotoxy(33,14);
printf("report card");
gotoxy(35,17);
printf("project");
printf("\n\n\n\n\n this project ismade by : 1.Mahadev Sakhare");
printf("\n\n 2.Tejas Suryavanshi");
printf("\n\n 3.Sanket Sutar");
printf("\n\n name of collage : RIT POLYTECHNIC COLLAGE PUNE");
getch();
}
}
void entry_menu()
{char ch2;
clrscr();
printf("\n\n\n\t entry menu");
printf("\n\n\t1.create student record");
18
printf("\n\n\t2.display all student record");
printf("\n\n\t3.search student records");
printf("\n\n\t4.modify student record");
printf("\n\n\t5.delete student record");
printf("\n\n\t6.back to main menu ");
printf("\n\n\tplease enter your choice(1-6)");
ch2=getche();
switch(ch2)
{
case '1':clrscr();
write_student();
break;
case '2':display_all();
break;
case '3':{
int num;
clrscr();
printf("\n\n\t please enter the roll no");
scanf("%d",&num);
display_sp(num);
}
break;
case '4':modify_student();
break;
case '5':delete_student();
break;
case '6':break;
19
default: printf("\a");entry_menu();
}
}
void main()
{char ch;
do
{
clrscr();
printf("\n\n\n\t main menu");
printf("\n\n\t01.result menu");
printf("\n\n\t02.entry/edit menu");
printf("\n\n\t03.exit");
printf("\n\n\tplease select your option(1-3)");
ch=getche();
switch(ch)
{ case '1':clrscr();
result();
break;
case '2':entry_menu();
break;
case '3':exit(0);
default:printf("\a");
}
}
while(ch!='3');
}
20
Output
1
2
3
Advantages and Disadvantages
Advantages
1.grade book management
2.record marks and result on a single database
3.add and manage students and declare results.
4.calculate scores,percentages,and grades.
Disadvantages
1.the student result management system is prone to hack.
2.minor technical glitches and issues.
3.administration cannot edit or modify scores after the
deadline
4
CONCLUSION
The projects clearly depicts that the Student Result System is very
efficient. It shows how the concept of File Handing can be used in
database management system in absence of databases like Oracle,
MySql etc. Although, this software can be further modified to be used as
multitasking and bigger software, but it effectively works under the
condition of limited resources and time.