Professional Documents
Culture Documents
RESULT MANAGEMENT
SYSTEM
CSE101
SUBMITTED TO:
Mr. BALRAJ KUMAR
CLASS:- B.Tech-M.TECH(MBA)(IT)
SUBJECT:- FOUNDATION
OF COMPUTER
ACKNOWLEDGEMENT
To many individuals I am indebted good
counsel and assistance in various ways in this
respect one of my sincerest thanks to “Mr.
BALRAJ KUMAR” of Lovely Professional
University, Phagwara, for their kind
cooperation and able guidance.
I owe a deep sense of indebtness of my
pureness that have been source of inspiration
in every work of my life.
I deeply express our indebtness and thanks to
all my faculty member of B.TECH (IT-M.Tech,
MBA) for their in valuable, guidance which
enable me to bring out this project in a
presentable manner.
CONTENTS
INTRODUCTION
PROPOSED SYSTEM
REQUIRMENT ANALYSIS
SOURCE CODE
TESTING
LANGUAGE
1.DESCRIPTION:-
Processor Asus
Platform Window XP
Professional
RAM 256 MB
Hard Disk 80 GB
Mouse Optical
Keyboard Multimedia
CD Drive 52.32.52x16x
REQUIREMENT ANALYSIS
HEADER FILES:-
ARRAY:-
1.ARRAY DATA TYPE:-First of all we have to
declare the data type of array.
STRUCTURE:-
We use structure for to make temporary variable.
SWITCH CASE:-It is use for selection. We use
switch case for selection case which we want to
perform at that time.
SOURCE CODE
// INCLUDING ALL THE HEADER FILES //
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<dos.h>
int clas;
char s;
int rollno;
char name[30];
char fatername[30];
char teachname[30];
int engmark;
int matmark;
int phymark;
int chemark;
int commark;
int total;
float percentage;
}stdres;
struct temp
{
int roll;
char name[30];
int clas;
char sec;
int total;
}temp;
void main()
{ // MAIN PROGRAM STARTS HERE //
clrscr();
gotoxy(20,6);
printf(" R E S U L T M A N A G E M E N T");
gotoxy(10,10);
printf(" CODED BY KALPENDRA SINGH ");
getch();
clrscr();
menu(); // CALLING FUNCTION TO PRINT MENU //
void create()
void add()
top:
{
int max1=100,max2=70,kar,l,m;
char ch,n;
FILE *result;
clrscr();
printf("CLASS:");
gotoxy (16,1);
printf("SECTION:");
gotoxy(31,1);
printf("ROLL NO:");
gotoxy(47,1);
printf("STUDENT'S NAME:");
gotoxy(1,5);
printf("FATHER NAME:");
gotoxy(45,5);
printf("CLASS TEACHER:");
gotoxy(1,9);
printf("S.NO.");
gotoxy(15,9);
printf("SUBJECT");
gotoxy(30,9);
printf("MARKS");
gotoxy(40,9);
printf("MAXIMUM MARKS");
gotoxy(70,9);
printf("GRADE");
gotoxy(3,11);
printf("1");
gotoxy(15,11);
printf("ENGLISH");
gotoxy(3,13);
printf("2");
gotoxy(15,13);
printf("MATHS");
gotoxy(3,15);
printf("3");
gotoxy(15,15);
printf("PHYSICS");
gotoxy(3,17);
printf("4");
gotoxy(15,17);
printf("CHEMISTRY");
gotoxy(3,19);
printf("5");
gotoxy(15,19);
printf("COMPUTER");
gotoxy(3,25);
printf("6");
gotoxy(15,25);
printf("TOTAL");
gotoxy(3,27);
printf("7");
gotoxy(15,27);
printf("PERCENTAGE");
// getting student information //
gotoxy(8,1);
scanf("%d",&m);
gotoxy(25,1);
n=getchar();
fflush(stdin);
result=fopen("result.txt","w");
gotoxy(40,1);
scanf("%d",&l);
kar=checking(m,n,l);
if(kar==1)
{
fclose(result);
goto top;
}
else
{
stdres.clas=m;
stdres.s=n;
stdres.rollno=l;
}
gotoxy(63,1);
gets(stdres.name);
fflush(stdin);
gotoxy(14,5);
gets(stdres.fatername);
fflush(stdin);
gotoxy(60,5);
gets(stdres.teachname);
gotoxy(47,13);
printf("100");
gotoxy(32,13);
scanf("%d",&stdres.matmark);
gotoxy(72,13);
print("%d",grade(stdres.matmark,max1));
gotoxy(47,15);
printf(" 70");
gotoxy(32,15);
scanf("%d",&stdres.phymark);
gotoxy(72,15);
printf("%d",grade(stdres.phymark,max2));
gotoxy(47,17);
printf(" 70");
gotoxy(32,17);
scanf("%d",stdres.chemark);
gotoxy(72,17);
printf("%d",grade(stdres.chemark,max2));
gotoxy(47,19);
printf(" 70");
gotoxy(32,19);
scanf("%d",stdres.commark);
gotoxy(72,19);
printf("%d",grade(stdres.commark,max2));
gotoxy(47,25);
printf("410");
gotoxy(31,25);
printf("%d%d%d%d
%d",total(stdres.engmark,stdres.matmark,stdres.phymark,stdres.chemark,st
dres.commark));
stdres.total=total(stdres.engmark,stdres.matmark,stdres.phymark,stdres.che
mark,stdres.commark);
gotoxy(32,27);
stdres.percentage=percent(stdres.total);
printf("%f",stdres.percentage);
gotoxy(80,50);
fwrite(&stdres,sizeof(stdres),1,result);
fclose(result);
getch();
menu();
}
}
void menu()
// FUNCTION THAT PRINTS THE MAIN MENU //
{
int ans;
clrscr();
gotoxy(25,10);
printf("M A I N M E N U");
gotoxy(17,15);
printf("1. Create the Primary Result Register");
gotoxy(17,16);
printf("2. Add Result");
gotoxy(17,17);
printf("3. Modify Result");
gotoxy(17,18);
printf("4. Search Result");
gotoxy(17,19);
printf("5. Delete Result");
gotoxy(17,20);
printf("6. Generate Merit List Grade wise per subject");
gotoxy(17,21);
printf("7. Generate Merit List on basis of Total Marks");
gotoxy(17,22);
printf("8. Exit");
gotoxy(40,25);
printf("Enter Option(1-8):");
scanf("%d",&ans);
// SWITCH USED TO MAKE PROGRAM MENU BASED //
switch(ans)
{
case 1:create();
break;
case 2: add();
break;
case 3: modify();
break;
case 4: search();
break;
case 5: delet();
break;
case 6: merit();
break;
case 7: merit1();
break;
case 8: exit(0);
}
void search()
clrscr();
printf("CLASS:");
gotoxy (16,1);
printf("SECTION:");
gotoxy(31,1);
printf("ROLL NO:");
gotoxy(47,1);
printf("STUDENT'S NAME:");
gotoxy(1,5);
printf("FATHER NAME:");
gotoxy(45,5);
printf("CLASS TEACHER:");
gotoxy(1,9);
printf("S.NO.");
gotoxy(15,9);
printf("SUBJECT");
gotoxy(30,9);
printf("MARKS");
gotoxy(40,9);
printf("MAXIMUM MARKS");
gotoxy(70,9);
printf("GRADE");
gotoxy(3,11);
printf("1");
gotoxy(15,11);
printf("ENGLISH");
gotoxy(3,13);
printf("2");
gotoxy(15,13);
printf("MATHS");
gotoxy(3,15);
printf("3");
gotoxy(15,15);
printf("PHYSICS");
gotoxy(3,17);
printf("4");
gotoxy(15,17);
printf("CHEMISTRY");
gotoxy(3,19);
printf("5");
gotoxy(15,19);
printf("COMPUTER");
gotoxy(3,25);
printf("6");
gotoxy(15,25);
printf("TOTAL");
gotoxy(3,27);
printf("7");
gotoxy(15,27);
printf("PERCENTAGE");
gotoxy(8,1);
printf("%d",stdres.clas); /*printing student information*/
gotoxy(25,1);
printf("%c",stdres.s);
gotoxy(40,1);
printf("%d",stdres.rollno);
gotoxy(63,1);
puts(stdres.name);
fflush(stdout);
gotoxy(14,5);
puts(stdres.fatername);
fflush(stdout);
gotoxy(60,5);
puts(stdres.teachname);
gotoxy(47,13);
printf("100");
gotoxy(32,13);
printf("%d",stdres.matmark);
gotoxy(72,13);
printf("%c",grade(stdres.matmark,max1));
gotoxy(47,15);
printf(" 70");
gotoxy(32,15);
printf("%d",stdres.phymark);
gotoxy(72,15);
printf("%c",grade(stdres.phymark,max2));
gotoxy(47,17);
printf(" 70");
gotoxy(32,17);
printf("%d",stdres.chemark);
gotoxy(72,17);
printf("%c",grade(stdres.chemark,max2));
gotoxy(47,19);
printf(" 70");
gotoxy(32,19);
printf("%d",stdres.commark);
gotoxy(72,19);
printf("%c",grade(stdres.commark,max2));
gotoxy(47,25);
printf("410");
gotoxy(31,25);
printf("%d%d%d%d
%d",total(stdres.engmark,stdres.matmark,stdres.phymark,stdres.chemark,st
dres.commark));
stdres.total=total(stdres.engmark,stdres.matmark,stdres.phymark,stdres.che
mark,stdres.commark);
gotoxy(32,27);
stdres.percentage=percent(stdres.total);
printf("%f",stdres.percentage);
gotoxy(80,50);
fclose(result);
getch();
menu();
}
else
fread(&stdres,sizeof(stdres),1,result);
if(flag==0)
{
clrscr();
gotoxy(23,23);
printf("SORRY! The Roll No.=%d does not exist.",roll);
gotoxy(23,25);
printf(" PLEASE! TRY AGAIN.");
fclose(result);
getch();
menu();
}
}
}
void modify()
int max1=100,max2=70,roll,flag=0,flag2=0;
char ch,z,n;
FILE *result,*tfile;
clrscr();
gotoxy(23,15);
printf("Enter the Roll No. of the student: ");
scan("%d",roll);
result=fopen("result.txt","r");
tfile=fopen("tfile.txt","w");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.rollno==roll)
{
flag=1;
clrscr();
gotoxy(23,25);
printf("RECORD FOUND");
gotoxy(23,27);
printf("PRESS ANY KEY TO CONTINUE ...");
getch();
clrscr();
printf("CLASS:");
gotoxy (16,1);
printf("SECTION:");
gotoxy(31,1);
printf("ROLL NO:");
gotoxy(47,1);
printf("STUDENT'S NAME:");
gotoxy(1,5);
printf("FATHER NAME:");
gotoxy(45,5);
printf("CLASS TEACHER:");
gotoxy(1,9);
printf("S.NO.");
gotoxy(15,9);
printf("SUBJECT");
gotoxy(30,9);
printf("MARKS");
gotoxy(40,9);
printf("MAXIMUM MARKS");
gotoxy(70,9);
printf("GRADE");
gotoxy(3,11);
printf("1");
gotoxy(15,11);
printf("ENGLISH");
gotoxy(3,13);
printf("2");
gotoxy(15,13);
printf("MATHS");
gotoxy(3,15);
printf("3");
gotoxy(15,15);
printf("PHYSICS");
gotoxy(3,17);
printf("4");
gotoxy(15,17);
printf("CHEMISTRY");
gotoxy(3,19);
printf("5");
gotoxy(15,19);
printf("COMPUTER");
gotoxy(3,25);
printf("6");
gotoxy(15,25);
printf("TOTAL");
gotoxy(3,27);
printf("7");
gotoxy(15,27);
printf("PERCENTAGE");
gotoxy(8,1);
printf("%d",stdres.clas); /*printing student information*/
gotoxy(25,1);
printf("%c",stdres.s);
gotoxy(40,1);
printf("%d",stdres.rollno);
gotoxy(63,1);
puts(stdres.name);
fflush(stdout);
gotoxy(14,5);
puts(stdres.fatername);
fflush(stdout);
gotoxy(60,5);
puts(stdres.teachname);
gotoxy(47,13);
printf("100");
gotoxy(32,13);
printf("%d",stdres.matmark);
gotoxy(72,13);
printf("%c",grade(stdres.matmark,max1));
gotoxy(47,15);
printf(" 70");
gotoxy(32,15);
printf("%d",stdres.phymark);
gotoxy(72,15);
printf("%c",grade(stdres.phymark,max2));
gotoxy(47,17);
printf(" 70");
gotoxy(32,17);
printf("%d",stdres.chemark);
gotoxy(72,17);
printf("%c",grade(stdres.chemark,max2));
gotoxy(47,19);
printf(" 70");
gotoxy(32,19);
printf("%d",stdres.commark);
gotoxy(72,19);
printf("%d",grade(stdres.commark,max2));
gotoxy(47,25);
printf("410");
gotoxy(31,25);
printf("%d%d%d%d
%d",total(stdres.engmark,stdres.matmark,stdres.phymark,stdres.chemark,st
dres.commark));stdres.total=total(stdres.engmark,stdres.matmark,stdres.ph
ymark,stdres.chemark,stdres.commark);
gotoxy(32,27);
stdres.percentage=percent(stdres.total);
printf("%f",stdres.percentage);
getch();
gotoxy(32,40);
printf("WOULD YOU LIKE TO MAKE ANY CHANGES");
printf("IF YES .. PRESS 'A' ");
z=getch();
if(z=='a'||z=='A')
{
flag2=1;
clrscr(); /*again printing format for
modification*/
printf("CLASS:");
gotoxy (16,1);
printf("SECTION:");
gotoxy(31,1);
printf("ROLL NO:");
gotoxy(47,1);
printf("STUDENT'S NAME:");
gotoxy(1,5);
printf("FATHER NAME:");
gotoxy(45,5);
printf("CLASS TEACHER:");
gotoxy(1,9);
printf("S.NO.");
gotoxy(15,9);
printf("SUBJECT");
gotoxy(30,9);
printf("MARKS");
gotoxy(40,9);
printf("MAXIMUM MARKS");
gotoxy(70,9);
printf("GRADE");
gotoxy(3,11);
printf("1");
gotoxy(15,11);
printf("ENGLISH");
gotoxy(3,13);
printf("2");
gotoxy(15,13);
printf("MATHS");
gotoxy(3,15);
printf("3");
gotoxy(15,15);
printf("PHYSICS");
gotoxy(3,17);
printf("4");
gotoxy(15,17);
printf("CHEMISTRY");
gotoxy(3,19);
printf("5");
gotoxy(15,19);
printf("COMPUTER");
gotoxy(3,25);
printf("6");
gotoxy(15,25);
printf("TOTAL");
gotoxy(3,27);
printf("7");
gotoxy(15,27);
printf("PERCENTAGE");
gotoxy(8,1);
printf("%d",stdres.clas); /*printing student information*/
gotoxy(25,1);
printf("%c",stdres.s);
gotoxy(40,1);
printf("%d",stdres.rollno);
gotoxy(63,1);
gotoxy(63,1);
gets(stdres.name);
fflush(stdin);
gotoxy(14,5);
gets(stdres.fatername);
fflush(stdin);
gotoxy(60,5);
gets(stdres.teachname);
gotoxy(47,13);
printf("100");
gotoxy(32,13);
scanf("%d",stdres.matmark);
gotoxy(72,13);
printf("%c",grade(stdres.matmark,max1));
gotoxy(47,15);
printf(" 70");
gotoxy(32,15);
scanf("%d",stdres.phymark);
gotoxy(72,15);
printf("%c",grade(stdres.phymark,max2));
gotoxy(47,17);
printf(" 70");
gotoxy(32,17);
scanf("%d",stdres.chemark);
gotoxy(72,17);
printf("%c",grade(stdres.chemark,max2));
gotoxy(47,19);
printf(" 70");
gotoxy(32,19);
scanf("%d",stdres.commark);
gotoxy(72,19);
printf("%c",grade(stdres.commark,max2));
gotoxy(47,25);
printf("410");
gotoxy(31,25);
printf("%d%d%d%d
%d",total(stdres.engmark,stdres.matmark,stdres.phymark,stdres.chemark,st
dres.commark));stdres.total=total(stdres.engmark,stdres.matmark,stdres.ph
ymark,stdres.chemark,stdres.commark);
gotoxy(32,27);
stdres.percentage=percent(stdres.total);
printf("%f",stdres.percentage);
gotoxy(80,50);
fwrite(&stdres,sizeof(stdres),1,tfile);
fread(&stdres,sizeof(stdres),1,result);
getch();
}
else
{
fwrite(&stdres,sizeof(stdres),1,tfile);
fread(&stdres,sizeof(stdres),1,result);
}
}
else
{
fwrite(&stdres,sizeof(stdres),1,tfile);
fread(&stdres,sizeof(stdres),1,result);
}
}
fclose(result);
fclose(tfile);
if(flag2==1)
{
result=fopen("result.txt","w");
tfile=fopen("tfile.txt","r");
fread(&stdres,sizeof(stdres),1,tfile);
while(tfile)
{
fwrite(&stdres,sizeof(stdres),1,result);
fread(&stdres,sizeof(stdres),1,tfile);
}
fclose(result);
fclose(tfile);
if(flag==0)
{
clrscr();
gotoxy(23,23);
printf("SORRY! The Roll No.=%d does not exist.",roll);
gotoxy(23,25);
printf(" PLEASE! TRY AGAIN.");
fclose(result);
getch();
menu();
}
void merit1()
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
l=total(stdres.engmark,stdres.matmark,stdres.phymark,stdres.chemark,stdre
s.commark);
if(l>368)
{
temp.roll=stdres.rollno;
strcpy(temp.name,stdres.name);
temp.clas=stdres.clas;
temp.sec=stdres.s;
temp.total=l;
fwrite(&temp,sizeof(temp),1,tfile);
}
fread(&stdres,sizeof(stdres),1,result);
fclose(result);
fclose(tfile);
gotoxy(12,1);
printf("ROLL NO.");
gotoxy(22,1);
printf("NAME");
gotoxy(38,1);
printf("TOTAL");
for(i=410;i>368;i--)
{
tfile=fopen("tfile.txt","r");
fread(&temp,sizeof(temp),1,tfile);
while(tfile)
{
if(temp.total==i)
{
flag=1;
gotoxy(15,k);
printf("%d",temp.roll);
gotoxy(22,k);
printf("%s",temp.name);
gotoxy(39,k++);
printf("%d",temp.total);
k++;
}
fread(&temp,sizeof(temp),1,tfile);
}
fclose(tfile);
}
if(flag==0)
{
clrscr();
gotoxy(15,20);
printf("SORRY! No record found.");
}
gotoxy(80,50);
getch();
menu();
void merit()
{
// FUNCTION TO GENERATE SECOND MERIT LIST //
int n,c,flag=0;
int k=3,i;
FILE *result;
clrscr();
gotoxy(15,2);
printf("MENU");
gotoxy(15,4);
printf("1. ENGLISH");
gotoxy(15,5);
printf("2. MATHEMATICS");
gotoxy(15,6);
printf("3. PHYSICS");
gotoxy(15,7);
printf("4. CHEMISTRY");
gotoxy(15,8);
printf("5. COMPUTER");
gotoxy(15,18);
printf("Enter your option: ");
printf("%d",&n);
clrscr();
switch(n)
{
/*english*/
case 1: back1:
gotoxy(15,2);
printf("1. Students with Grade 'A'");
gotoxy(15,3);
printf("2. Students with Grade 'B'");
gotoxy(15,4);
printf("3. Students with Grade 'C'");
gotoxy(15,5);
printf("4. Students with Grade 'E' ");
gotoxy(15,7);
printf("Enter your Option: ");
scanf("%d",&c);
clrscr();
gotoxy(14,1);
printf("Roll no.");
gotoxy(25,1);
printf("Name");
gotoxy(37,1);
printf("Class");
gotoxy(45,1);
printf("Section");
gotoxy(60,1);
printf("Marks");
switch(c)
{
case 1: for(i=100;i>74;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.engmark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%s",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.engmark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
gotoxy(80,50);
}
if(flag==0)
{
gotoxy(20,22);
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
}
getch();
break;
case 2: for(i=74;i>60;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.engmark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%d",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.engmark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
}
getch();
break;
case 3: for(i=60;i>33;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.engmark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%s",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.engmark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
}
getch();
break;
case 4: for( i=33;i>0;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.engmark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%s",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.engmark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
}
getch();
break;
default:clrscr();
gotoxy(25,25);
printf("Invalid Option.");
getch();
goto back1;
}
menu();
/*mathematics*/
case 2: back2:
gotoxy(15,2);
printf("1. Students with Grade 'A'");
gotoxy(15,3);
printf("2. Students with Grade 'B'");
gotoxy(15,4);
printf("3. Students with Grade 'C'");
gotoxy(15,5);
printf("4. Students with Grade 'E' ");
gotoxy(15,7);
printf("Enter your Option: ");
scanf("%d",&c);
clrscr();
gotoxy(14,1);
printf("Roll no.");
gotoxy(25,1);
printf("Name");
gotoxy(37,1);
printf("Class");
gotoxy(45,1);
printf("Section");
gotoxy(60,1);
printf("Marks");
switch(c)
{
case 1: for(i=100;i>74;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.matmark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%s",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%d",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.matmark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
gotoxy(80,50);
}
if(flag==0)
{
gotoxy(20,22);
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
getch();
break;
case 2: for(i=74;i>60;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.matmark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%d",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("5c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.matmark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
}
getch();
break;
case 3: for(i=60;i>33;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.matmark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%s",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.matmark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
}
getch();
break;
case 4: for( i=33;i>0;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.matmark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%s",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.matmark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
}
getch();
break;
default:clrscr();
gotoxy(25,25);
printf("Invalid Option.");
getch();
goto back2;
}
menu();
/*physics*/
case 3: back3:
gotoxy(15,2);
printf("1. Students with Grade 'A'");
gotoxy(15,3);
printf("2. Students with Grade 'B'");
gotoxy(15,4);
printf("3. Students with Grade 'C'");
gotoxy(15,5);
printf("4. Students with Grade 'E' ");
gotoxy(15,7);
printf("Enter your Option: ");
scanf("%d",&c);
clrscr();
gotoxy(14,1);
printf("Roll no.");
gotoxy(25,1);
printf("Name");
gotoxy(37,1);
printf("Class");
gotoxy(45,1);
printf("Section");
gotoxy(60,1);
printf("Marks");
switch(c)
{
case 1: for(i=100;i>74;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.phymark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%s",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.phymark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
gotoxy(80,50);
}
if(flag==0)
{
gotoxy(20,22);
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
getch();
break;
case 2: for(i=74;i>60;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.phymark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%s",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.phymark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
}
getch();
break;
case 3: for(i=60;i>33;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.phymark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%s",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.phymark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
}
getch();
break;
case 4: for( i=33;i>0;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.phymark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%s",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.phymark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
}
getch();
break;
default:clrscr();
gotoxy(25,25);
printf("Invalid Option.");
getch();
goto back3;
}
menu();
/*chemistry*/
case 4: back4:
gotoxy(15,2);
printf("1. Students with Grade 'A'");
gotoxy(15,3);
printf("2. Students with Grade 'B'");
gotoxy(15,4);
printf("3. Students with Grade 'C'");
gotoxy(15,5);
printf("4. Students with Grade 'E' ");
gotoxy(15,7);
printf("Enter your Option: ");
scanf("%d",&c);
clrscr();
gotoxy(14,1);
printf("Roll no.");
gotoxy(25,1);
printf("Name");
gotoxy(37,1);
printf("Class");
gotoxy(45,1);
printf("Section");
gotoxy(60,1);
printf("Marks");
switch(c)
{
case 1: for(i=100;i>74;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.chemark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%d",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.chemark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
gotoxy(80,50);
}
if(flag==0)
{
gotoxy(20,22);
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
getch();
break;
case 2: for(i=74;i>60;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.chemark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%d",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.chemark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
}
getch();
break;
case 3: for(i=60;i>33;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.chemark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%d",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.chemark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
}
getch();
break;
case 4: for( i=33;i>0;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.chemark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%d",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.chemark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
}
getch();
break;
default:clrscr();
gotoxy(25,25);
printf("Invalid Option.");
getch();
goto back4;
}
menu();
/*computer*/
case 5: back5:
gotoxy(15,2);
printf("1. Students with Grade 'A'");
gotoxy(15,3);
printf("2. Students with Grade 'B'");
gotoxy(15,4);
printf("3. Students with Grade 'C'");
gotoxy(15,5);
printf("4. Students with Grade 'E' ");
gotoxy(15,7);
printf("Enter your Option: ");
scanf("%d",&c);
clrscr();
gotoxy(14,1);
printf("Roll no.");
gotoxy(25,1);
printf("Name");
gotoxy(37,1);
printf("Class");
gotoxy(45,1);
printf("Section");
gotoxy(60,1);
printf("Marks");
switch(c)
{
case 1: for(i=100;i>74;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.commark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%d",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.commark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
gotoxy(80,50);
}
if(flag==0)
{
gotoxy(20,22);
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
getch();
break;
case 2: for(i=74;i>60;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.commark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%d",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.commark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
}
getch();
break;
case 3: for(i=60;i>33;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.commark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%d",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.commark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
}
getch();
break;
case 4: for( i=33;i>0;i--)
{
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.commark==i)
{
flag=1;
gotoxy (17,k);
printf("%d",stdres.rollno);
gotoxy(25,k);
printf("%d",stdres.name);
gotoxy(39,k);
printf("%d",stdres.clas);
gotoxy(47,k);
printf("%c",stdres.s);
gotoxy(62,k++);
printf("%d",stdres.commark);
k++;
}
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
printf("NO RECORD FOUND.");
gotoxy(80,50);
}
getch();
break;
default:clrscr();
gotoxy(25,25);
printf("Invalid Option.");
getch();
goto back5;
}
menu();
default: clrscr();
printf("INVALID OPTION");
getch();
menu();
gotoxy(80,50);
void delet()
result=fopen("result.txt","r");
tfile=fopen("tfile.txt","w");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
if(stdres.clas==s&&stdres.s==t&&stdres.rollno==r)
{
clrscr();
flag=1;
gotoxy(20,20);
printf("RECORD FOUND AND DELETED.");
getch();
}
else
fwrite(&stdres,sizeof(stdres),1,tfile);
fread(&stdres,sizeof(stdres),1,result);
}
fclose(result);
fclose(tfile);
if(flag==0)
{
clrscr();
gotoxy(25,22);
printf("RECORD NOT FOUND.");
getch();
exit(0);
}
result=fopen("result.txt","w");
tfile=fopen("tfile.txt","r");
fread(&stdres,sizeof(stdres),1,tfile);
while(tfile)
{
fwrite(&stdres,sizeof(stdres),1,result);
fread(&stdres,sizeof(stdres),1,tfile);
}
fclose(result);
fclose(tfile);
clrscr();
printf("New File after Deletion of Record");
getch();
result=fopen("result.txt","r");
fread(&stdres,sizeof(stdres),1,result);
while(result)
{
int max1=100,max2=70;
char ch;
clrscr();
printf("CLASS:");
gotoxy (16,1);
printf("SECTION:");
gotoxy(31,1);
printf("ROLL NO:");
gotoxy(47,1);
printf("STUDENT'S NAME:");
gotoxy(1,5);
printf("FATHER NAME:");
gotoxy(45,5);
printf("CLASS TEACHER:");
gotoxy(1,9);
printf("S.NO.");
gotoxy(15,9);
printf("SUBJECT");
gotoxy(30,9);
printf("MARKS");
gotoxy(40,9);
printf("MAXIMUM MARKS");
gotoxy(70,9);
printf("GRADE");
gotoxy(3,11);
printf("1");
gotoxy(15,11);
printf("ENGLISH");
gotoxy(3,13);
printf("2");
gotoxy(15,13);
printf("MATHS");
gotoxy(3,15);
printf("3");
gotoxy(15,15);
printf("PHYSICS");
gotoxy(3,17);
printf("4");
gotoxy(15,17);
printf("CHEMISTRY");
gotoxy(3,19);
printf("5");
gotoxy(15,19);
printf("COMPUTER");
gotoxy(3,25);
printf("6");
gotoxy(15,25);
printf("TOTAL");
gotoxy(3,27);
printf("7");
gotoxy(15,27);
printf("PERCENTAGE");
gotoxy(8,1);
printf("%d",stdres.clas); /*printing student information*/
gotoxy(25,1);
printf("%c",stdres.s);
gotoxy(40,1);
printf("%d",stdres.rollno);
gotoxy(63,1);
puts(stdres.name);
fflush(stdout);
gotoxy(14,5);
puts(stdres.fatername);
fflush(stdout);
gotoxy(60,5);
puts(stdres.teachname);
gotoxy(47,13);
printf("100");
gotoxy(32,13);
printf("%d",stdres.matmark);
gotoxy(72,13);
printf("%c",grade(stdres.matmark,max1));
gotoxy(47,15);
printf(" 70");
gotoxy(32,15);
printf("%d",stdres.phymark);
gotoxy(72,15);
printf("%c",grade(stdres.phymark,max2));
gotoxy(47,17);
printf(" 70");
gotoxy(32,17);
printf("%d",stdres.chemark);
gotoxy(72,17);
printf("%c",grade(stdres.chemark,max2));
gotoxy(47,19);
printf(" 70");
gotoxy(32,19);
printf("%d",stdres.commark);
gotoxy(72,19);
printf("%c",grade(stdres.commark,max2));
gotoxy(47,25);
printf("410");
gotoxy(31,25);
printf("%d%d%d%d%d",total(stdres.engmark, stdres.matmark,
stdres.phymark, stdres.chemark,stdres.commark));
stdres.total = total(stdres.engmark,stdres.matmark, stdres.phymark,
stdres.chemark, stdres.commark);
gotoxy(32,27);
stdres.percentage=percent(stdres.total);
printf("%f",stdres.percentage);
gotoxy(80,50);
fread(&stdres,sizeof(stdres),1,result);
getch();
fclose(result);
menu();
TESTING
R E S U LT MANAG E M E N T
MAIN MENU