📄 resultmanagementprogram.txt
字号:
getch();
break;
case 2: for(i=74;i>60;i--)
{
result.open("result.dat",ios::in|ios::binary);
result.read((char*)&stdres,sizeof(stdres));
while(result)
{
if(stdres.phymark==i)
{
flag=1;
gotoxy (17,k);
cout<<stdres.rollno;
gotoxy(25,k);
cout<<stdres.name;
gotoxy(39,k);
cout<<stdres.clas;
gotoxy(47,k);
cout<<stdres.s;
gotoxy(62,k++);
cout<<stdres.phymark;
k++;
}
result.read((char*)&stdres,sizeof(stdres));
}
result.close();
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
cout<<"NO RECORD FOUND.";
gotoxy(80,50);
}
getch();
break;
case 3: for(i=60;i>33;i--)
{
result.open("result.dat",ios::in|ios::binary);
result.read((char*)&stdres,sizeof(stdres));
while(result)
{
if(stdres.phymark==i)
{
flag=1;
gotoxy (17,k);
cout<<stdres.rollno;
gotoxy(25,k);
cout<<stdres.name;
gotoxy(39,k);
cout<<stdres.clas;
gotoxy(47,k);
cout<<stdres.s;
gotoxy(62,k++);
cout<<stdres.phymark;
k++;
}
result.read((char*)&stdres,sizeof(stdres));
}
result.close();
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
cout<<"NO RECORD FOUND.";
gotoxy(80,50);
}
getch();
break;
case 4: for( i=33;i>0;i--)
{
result.open("result.dat",ios::in|ios::binary);
result.read((char*)&stdres,sizeof(stdres));
while(result)
{
if(stdres.phymark==i)
{
flag=1;
gotoxy (17,k);
cout<<stdres.rollno;
gotoxy(25,k);
cout<<stdres.name;
gotoxy(39,k);
cout<<stdres.clas;
gotoxy(47,k);
cout<<stdres.s;
gotoxy(62,k++);
cout<<stdres.phymark;
k++;
}
result.read((char*)&stdres,sizeof(stdres));
}
result.close();
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
cout<<"NO RECORD FOUND.";
gotoxy(80,50);
}
getch();
break;
default:clrscr();
gotoxy(25,25);
cout<<"Invalid Option.";
getch();
goto back3;
}
menu();
/*chemistry*/
case 4: back4:
gotoxy(15,2);
cout<<"1. Students with Grade 'A'";
gotoxy(15,3);
cout<<"2. Students with Grade 'B'";
gotoxy(15,4);
cout<<"3. Students with Grade 'C'";
gotoxy(15,5);
cout<<"4. Students with Grade 'E' ";
gotoxy(15,7);
cout<<"Enter your Option: ";
cin>>c;
clrscr();
gotoxy(14,1);
cout<<"Roll no.";
gotoxy(25,1);
cout<<"Name";
gotoxy(37,1);
cout<<"Class";
gotoxy(45,1);
cout<<"Section";
gotoxy(60,1);
cout<<"Marks";
switch(c)
{
case 1: for(i=100;i>74;i--)
{
result.open("result.dat",ios::in|ios::binary);
result.read((char*)&stdres,sizeof(stdres));
while(result)
{
if(stdres.chemark==i)
{
flag=1;
gotoxy (17,k);
cout<<stdres.rollno;
gotoxy(25,k);
cout<<stdres.name;
gotoxy(39,k);
cout<<stdres.clas;
gotoxy(47,k);
cout<<stdres.s;
gotoxy(62,k++);
cout<<stdres.chemark;
k++;
}
result.read((char*)&stdres,sizeof(stdres));
}
result.close();
gotoxy(80,50);
}
if(flag==0)
{
gotoxy(20,22); gotoxy(20,22);
cout<<"NO RECORD FOUND.";
gotoxy(80,50);
}
getch();
break;
case 2: for(i=74;i>60;i--)
{
result.open("result.dat",ios::in|ios::binary);
result.read((char*)&stdres,sizeof(stdres));
while(result)
{
if(stdres.chemark==i)
{
flag=1;
gotoxy (17,k);
cout<<stdres.rollno;
gotoxy(25,k);
cout<<stdres.name;
gotoxy(39,k);
cout<<stdres.clas;
gotoxy(47,k);
cout<<stdres.s;
gotoxy(62,k++);
cout<<stdres.chemark;
k++;
}
result.read((char*)&stdres,sizeof(stdres));
}
result.close();
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
cout<<"NO RECORD FOUND.";
gotoxy(80,50);
}
getch();
break;
case 3: for(i=60;i>33;i--)
{
result.open("result.dat",ios::in|ios::binary);
result.read((char*)&stdres,sizeof(stdres));
while(result)
{
if(stdres.chemark==i)
{
flag=1;
gotoxy (17,k);
cout<<stdres.rollno;
gotoxy(25,k);
cout<<stdres.name;
gotoxy(39,k);
cout<<stdres.clas;
gotoxy(47,k);
cout<<stdres.s;
gotoxy(62,k++);
cout<<stdres.chemark;
k++;
}
result.read((char*)&stdres,sizeof(stdres));
}
result.close();
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
cout<<"NO RECORD FOUND.";
gotoxy(80,50);
}
getch();
break;
case 4: for( i=33;i>0;i--)
{
result.open("result.dat",ios::in|ios::binary);
result.read((char*)&stdres,sizeof(stdres));
while(result)
{
if(stdres.chemark==i)
{
flag=1;
gotoxy (17,k);
cout<<stdres.rollno;
gotoxy(25,k);
cout<<stdres.name;
gotoxy(39,k);
cout<<stdres.clas;
gotoxy(47,k);
cout<<stdres.s;
gotoxy(62,k++);
cout<<stdres.chemark;
k++;
}
result.read((char*)&stdres,sizeof(stdres));
}
result.close();
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
cout<<"NO RECORD FOUND.";
gotoxy(80,50);
}
getch();
break;
default:clrscr();
gotoxy(25,25);
cout<<"Invalid Option.";
getch();
goto back4;
}
menu();
/*computer*/
case 5: back5:
gotoxy(15,2);
cout<<"1. Students with Grade 'A'";
gotoxy(15,3);
cout<<"2. Students with Grade 'B'";
gotoxy(15,4);
cout<<"3. Students with Grade 'C'";
gotoxy(15,5);
cout<<"4. Students with Grade 'E' ";
gotoxy(15,7);
cout<<"Enter your Option: ";
cin>>c;
clrscr();
gotoxy(14,1);
cout<<"Roll no.";
gotoxy(25,1);
cout<<"Name";
gotoxy(37,1);
cout<<"Class";
gotoxy(45,1);
cout<<"Section";
gotoxy(60,1);
cout<<"Marks";
switch(c)
{
case 1: for(i=100;i>74;i--)
{
result.open("result.dat",ios::in|ios::binary);
result.read((char*)&stdres,sizeof(stdres));
while(result)
{
if(stdres.commark==i)
{
flag=1;
gotoxy (17,k);
cout<<stdres.rollno;
gotoxy(25,k);
cout<<stdres.name;
gotoxy(39,k);
cout<<stdres.clas;
gotoxy(47,k);
cout<<stdres.s;
gotoxy(62,k++);
cout<<stdres.commark;
k++;
}
result.read((char*)&stdres,sizeof(stdres));
}
result.close();
gotoxy(80,50);
}
if(flag==0)
{
gotoxy(20,22); gotoxy(20,22);
cout<<"NO RECORD FOUND.";
gotoxy(80,50);
}
getch();
break;
case 2: for(i=74;i>60;i--)
{
result.open("result.dat",ios::in|ios::binary);
result.read((char*)&stdres,sizeof(stdres));
while(result)
{
if(stdres.commark==i)
{
flag=1;
gotoxy (17,k);
cout<<stdres.rollno;
gotoxy(25,k);
cout<<stdres.name;
gotoxy(39,k);
cout<<stdres.clas;
gotoxy(47,k);
cout<<stdres.s;
gotoxy(62,k++);
cout<<stdres.commark;
k++;
}
result.read((char*)&stdres,sizeof(stdres));
}
result.close();
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
cout<<"NO RECORD FOUND.";
gotoxy(80,50);
}
getch();
break;
case 3: for(i=60;i>33;i--)
{
result.open("result.dat",ios::in|ios::binary);
result.read((char*)&stdres,sizeof(stdres));
while(result)
{
if(stdres.commark==i)
{
flag=1;
gotoxy (17,k);
cout<<stdres.rollno;
gotoxy(25,k);
cout<<stdres.name;
gotoxy(39,k);
cout<<stdres.clas;
gotoxy(47,k);
cout<<stdres.s;
gotoxy(62,k++);
cout<<stdres.commark;
k++;
}
result.read((char*)&stdres,sizeof(stdres));
}
result.close();
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
cout<<"NO RECORD FOUND.";
gotoxy(80,50);
}
getch();
break;
case 4: for( i=33;i>0;i--)
{
result.open("result.dat",ios::in|ios::binary);
result.read((char*)&stdres,sizeof(stdres));
while(result)
{
if(stdres.commark==i)
{
flag=1;
gotoxy (17,k);
cout<<stdres.rollno;
gotoxy(25,k);
cout<<stdres.name;
gotoxy(39,k);
cout<<stdres.clas;
gotoxy(47,k);
cout<<stdres.s;
gotoxy(62,k++);
cout<<stdres.commark;
k++;
}
result.read((char*)&stdres,sizeof(stdres));
}
result.close();
}
gotoxy(80,50);
if(flag==0)
{
gotoxy(20,22);
cout<<"NO RECORD FOUND.";
gotoxy(80,50);
}
getch();
break;
default:clrscr();
gotoxy(25,25);
cout<<"Invalid Option.";
getch();
goto back5;
}
menu();
default: clrscr();
cout<<"INVALID OPTION";
getch();
menu();
}
gotoxy(80,50);
}
void delet()
{ // FUNCTION TO DELETE A RESULT ENTRY //
clrscr();
student stud;
int r,s,flag=0;
char t,z;
cout<<"Enter the class: ";
cin>>s;
cout<<"Enter the section: ";
cin>>t;
cout<<"Enter the roll no.";
cin>>r;
fstream result,tfile;
result.open("result.dat",ios::in|ios::binary);
tfile.open("tfile.dat",ios::out|ios::binary);
result.read((char*)&stdres,sizeof(stdres));
while(result)
{
if(stdres.clas==s&&stdres.s==t&&stdres.rollno==r)
{
clrscr();
flag=1;
gotoxy(20,20);
cout<<"RECORD FOUND AND DELETED.";
getch();
}
else
tfile.write((char*)&stdres,sizeof(stdres));
result.read((char*)&stdres,sizeof(stdres));
}
result.close();
tfile.close();
if(flag==0)
{
clrscr();
gotoxy(25,22);
cout<<"RECORD NOT FOUND.";
getch();
exit(0);
}
result.open("result.dat",ios::out|ios::binary);
tfile.open("tfile.dat",ios::in|ios::binary);
tfile.read((char*)&stdres,sizeof(stdres));
while(tfile)
{
result.write((char*)&stdres,sizeof(stdres));
tfile.read((char*)&stdres,sizeof(stdres));
}
result.close();
tfile.close();
/*DISPLAYING THE RECORDS AFTER DELETION*/
clrscr();
cout<<"New File after Deletion of Record";
getch();
result.open("result.dat",ios::in|ios::binary);
result.read((char*)&stdres,sizeof(stdres));
while(result)
{
clrscr();
int max1=100,max2=70;
char ch;
cout<<"CLASS:";
gotoxy (16,1);
cout<<"SECTION:";
gotoxy(31,1);
cout<<"ROLL NO:";
gotoxy(47,1);
cout<<"STUDENT'S NAME:";
gotoxy(1,5);
cout<<"FATHER NAME:";
gotoxy(45,5);
cout<<"CLASS TEACHER:";
gotoxy(1,9);
cout<<"S.NO.";
gotoxy(15,9);
cout<<"SUBJECT";
gotoxy(30,9);
cout<<"MARKS";
gotoxy(40,9);
cout<<"MAXIMUM MARKS";
gotoxy(70,9);
cout<<"GRADE";
gotoxy(3,11);
cout<<"1";
gotoxy(15,11);
cout<<"ENGLISH";
gotoxy(3,13);
cout<<"2";
gotoxy(15,13);
cout<<"MATHS";
gotoxy(3,15);
cout<<"3";
gotoxy(15,15);
cout<<"PHYSICS";
gotoxy(3,17);
cout<<"4";
gotoxy(15,17);
cout<<"CHEMISTRY";
gotoxy(3,19);
cout<<"5";
gotoxy(15,19);
cout<<"COMPUTER";
gotoxy(3,25);
cout<<"6";
gotoxy(15,25);
cout<<"TOTAL";
gotoxy(3,27);
cout<<"7";
gotoxy(15,27);
cout<<"PERCENTAGE";
gotoxy(8,1);
cout<<stdres.clas; /*printing student information*/
gotoxy(25,1);
cout<<stdres.s;
gotoxy(40,1);
cout<<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,11); /*marks table*/
cout<<"100";
gotoxy(32,11);
cout<<stdres.engmark;
gotoxy(72,11);
cout<<stud.grade(stdres.engmark,max1);
gotoxy(47,13);
cout<<"100";
gotoxy(32,13);
cout<<stdres.matmark;
gotoxy(72,13);
cout<<stud.grade(stdres.matmark,max1);
gotoxy(47,15);
cout<<" 70";
gotoxy(32,15);
cout<<stdres.phymark;
gotoxy(72,15);
cout<<stud.grade(stdres.phymark,max2);
gotoxy(47,17);
cout<<" 70";
gotoxy(32,17);
cout<<stdres.chemark;
gotoxy(72,17);
cout<<stud.grade(stdres.chemark,max2);
gotoxy(47,19);
cout<<" 70";
gotoxy(32,19);
cout<<stdres.commark;
gotoxy(72,19);
cout<<stud.grade(stdres.commark,max2);
gotoxy(47,25);
cout<<"410";
gotoxy(31,25);
cout<< stud.total(stdres.engmark, stdres.matmark, stdres.phymark, stdres.chemark,stdres.commark);
stdres.total = stud.total(stdres.engmark,stdres.matmark, stdres.phymark, stdres.chemark, stdres.commark);
gotoxy(32,27);
stdres.percentage=stud.percent(stdres.total);
cout<<stdres.percentage;
gotoxy(80,50);
result.read((char*)&stdres,sizeof(stdres));
getch();
}
result.close();
menu();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -