Академический Документы
Профессиональный Документы
Культура Документы
h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<bios.h>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include<fstream.h>
#include<ctype.h>
void student_menu();
void updown();
void mark_menu();
int records=0;
struct s_date
{
int dd,mm,yyyy;
};
//DEFINING OF Stuctures
struct student
{
char address[30];
char fname[30];
int redgno;
s_date dob;
char clas[5];
char name[20];
int sub1,sub2,sub3,sub4,sub5,total;
float avg,pre;
char div[10];
char st_code[10];
}s[10];
l=strlen(a);
if(l<strlen(b))
l=strlen(b);
if(l<strlen(c))
l=strlen(c);
if(l<strlen(d))
l=strlen(d);
if(l<strlen(e))
l=strlen(e);
if(l<strlen(f))
l=strlen(f);
l+=4;
textbackground(back);
for(i=1;i<l+2;i++)
for(j=1;j<lines+4;j++)
{
gotoxy(i+x,j+y);
cputs(" ");
}
gotoxy(x,y);
cputs("É");
for(i=x+1;i<l+x+1;i++)
{
gotoxy(i,y);
cputs("Í");
gotoxy(i,y+lines+3);
cputs("Í");
}
gotoxy(x+1+l,y);
cputs("»");
for(i=y+1;i<lines+4+y;i++)
{
gotoxy(x,i);
cputs("º");
gotoxy(x+l+1,i);
cputs("º");
}
gotoxy(x,y+lines+3);
cputs("È");
gotoxy(x+l+1,y+lines+3);
cputs("¼");
j=l-strlen(a);
j=j/2;
gotoxy(j+x+1,++y);
cputs(a);
j=l-strlen(b);
j=j/2;
gotoxy(x+j+1,y+1);
cputs(b);
j=l-strlen(c);
j=j/2;
gotoxy(x+j+1,2+y);
cputs(c);
j=l-strlen(d);
j=j/2;
gotoxy(x+j+1,3+y);
cputs(d);
j=l-strlen(e);
j=j/2;
gotoxy(x+j+1,4+y);
cputs(e);
j=l-strlen(f)-3;
j=j/2;
gotoxy(x+j+1,y+lines+1);
strcat(f1," ");
strcat(f1,f);
strcat(f1," ");
textbackground(BLACK);
cputs(f1);
textcolor(BLACK);
for(i=0;i<lines+3;i++)
{
gotoxy(x+l+2,i+y);
cputs("Û");
}
for(i=1;i<l+3;i++)
{
gotoxy(x+i,y+lines+3);
cputs("ß");
}
}
sa:
clrscr();
gotoxy(20,2);
cout<<"Student Data Entry Form";
gotoxy(20,3);
cout<<"=======================";
gotoxy(10,7);
cout<<"Enter The Stream Code:\n1.Science Stream\n2.Commerce Streame";
gotoxy(32,7);
cin>>st;
switch(st)
{
case 1:strcpy(s[i].st_code,"Science");
break;
case 2:strcpy(s[i].st_code,"Commerce");
break;
default:cout<<"\n\t\t\tInvalid Type.\n\nDo you want to continue?(Y/N)...";
cin>>ch;
if (ch=='y'||ch=='Y')
{
clrscr();
goto sa;
}
else add();
}
clrscr();
gotoxy(20,2);
cout<<"Student Data Entry Form";
gotoxy(20,3);
cout<<"=======================";
gotoxy(10,5);
cout<<"Enter The Following Marks";
gotoxy(10,10);
cout<<"Sub1(Eng/Eng):"; //Sub 1
gotoxy(30,10);
cin>>s[i].sub1;
gotoxy(10,12);
cout<<"Sub2(Math/A/C):"; //Sub 2
gotoxy(30,12);
cin>>s[i].sub2;
gotoxy(10,14);
cout<<"Sub3(Phy/Eco):"; //Sub 3
gotoxy(30,14);
cin>>s[i].sub3;
gotoxy(10,16);
cout<<"Sub4(Chem/B.st):"; //Sub 4
gotoxy(30,16);
cin>>s[i].sub4;
gotoxy(10,18); //Sub 5
cout<<"Sub5(Bio/Comp):";
gotoxy(30,18);
cin>>s[i].sub5;
s[i].total=s[i].sub1+s[i].sub2+s[i].sub3+s[i].sub4+s[i].sub5;
if((s[i].sub1<33)||(s[i].sub2<33)||(s[i].sub3<33)||(s[i].sub4<33)||(s[i].sub5<33))
strcpy(s[i].div,"Fail");
else if(s[i].total>=375)
strcpy(s[i].div,"Distintion");
else if((s[i].total>=300)&&(s[i].total<375))
strcpy(s[i].div,"First Class");
else if((s[i].total>=250)&&(s[i].total<300))
strcpy(s[i].div,"Second Class");
else if(s[i].total<165)
strcpy(s[i].div,"Fail");
strcat(fn,s[i].name);
strcat(fn,".txt");
file.open(fn,ios::out);
if(!file)
{
gotoxy(25,79);
cout<<".";
}
file<<" Report Card Of "<<s[i].name
<<"\nRegistration Number:"<<s[i].redgno<<"\nClass:"<<s[i].clas
<<"\nAddress:"<<s[i].address<<"\nFather's Name:"<<s[i].fname
<<"\nDate Of Birth:"<<s[i].dob.dd<<"-"<<s[i].dob.mm<<"-"<<s[i].dob.yyyy
<<"\nStream:"<<s[i].st_code<<"\n\n\
-------------------------------------------------------------------------------\
\nSubject Marks\n-------------\nSubject 1 :"
<<s[i].sub1<<"\nSubject 2 :"<<s[i].sub2<<"\nSubject 3 :"<<s[i].sub3
<<"\nSubject 4 :"<<s[i].sub4<<"\nSubject 5 :"<<s[i].sub5
<<"\nTotal :"<<s[i].total<<"\nGrade :"<<s[i].div;
file.close();
i++;
gotoxy(10,22);
cout<<"Want More Record To Be Written?(Y/N)......";
cin>>ch;
}while(ch=='y'||ch=='Y');
if(ch=='n'||ch=='N') student_menu();
}
gotoxy(30,5+i);
cputs(" ");
}
delay(800);
clrscr();
for (i=25;i>10;i--)
{
delay(180);
clrscr();
gotoxy(30,i);
cputs("Special Effects By");
gotoxy(30,2+i);
cputs("Navi Arora");
gotoxy(30,3+i);
cputs("Simran Arora");
gotoxy(30,4+i);
cputs(" ");
}
delay(800);
clrscr();
for (i=25;i>10;i--)
{
delay(180);
clrscr();
gotoxy(30,i);
cputs("Special Thanks To");
gotoxy(30,2+i);
cputs("Nannu");
gotoxy(30,3+i);
cputs("cbse-sample-papers.blogspot.com");
gotoxy(30,4+i);
cputs(" ");
}
delay(800);
clrscr();
for (i=25;i>10;i--)
{
delay(180);
clrscr();
gotoxy(30,i);
cputs("Developed At");
gotoxy(30,2+i);
cputs("www.NaviArora.com");
gotoxy(30,4+i);
cputs(" ");
}
delay(800);
clrscr();
for (i=25;i>10;i--)
{
delay(180);
clrscr();
textcolor(RED+BLINK);
gotoxy(10,i);
cputs(" WARNING!!");
textcolor(BLUE);
gotoxy(10,1+i);
cputs(" This program is protected by copyright laws");
gotoxy(10,2+i);
cputs(" and International Treaties");
gotoxy(10,4+i);
cputs("Illigal Copying or reproduction of this software is punishable ");
gotoxy(10,5+i);
cputs(" and is against the protocol ");
}
delay(3000);
}
/*****************************Draws a box*****************************/
void box(int x,int y,int width,int height)
{
int i,j;
//Clear the space.
for(j=y;j<y+height;j++)
for(i=x;i<x+width;i++)
{
gotoxy(i,j);cputs(" ");
}
//Draw the box
for(i=x+1;i<x+width;i++)
{
gotoxy(i,y);cputs("Í");
gotoxy(i,y+height);cputs("Í");
}
for(i=y+1;i<y+height;i++)
{
gotoxy(x,i);cputs("º");
gotoxy(x+width,i);cputs("º");
}
//The Conners
gotoxy(x,y);cputs("É");
gotoxy(x+width,y);cputs("»");
gotoxy(x,y+height);cputs("È");
gotoxy(x+width,y+height);cputs("¼");
}
//Other options
int fill=1; //This will make all menus equal in length
int show_numbers=0; //Will show Item index
for(int i=0;i<num;i++)
{
if(strlen(item[i])>lengthest) lengthest=strlen(item[i]);
}
if(strlen(title)>lengthest) lengthest=strlen(title);
box(x,y-1,lengthest+1,num+3);
x++;
textbackground(default_back);textcolor(default_fore);
gotoxy(x,y);cputs(title);
y = y + 2;
switch(key)
{
case 72: //UP
//Note that 'sel' starts at 1 and not 0.
if(sel==1) text(x,y+num-1,0,item[num-1]);
else text(x,y+sel-2,0,item[sel-2]);
if(sel==1) sel=num;
else sel--;
break;
case 80: //DOWN
if(sel==num) text(x,y,0,item[0]);
else text(x,y+sel,0,item[sel]);
if(sel==num) sel=1;
else sel++;
break;
//Number selections.
case '1':
text(x,y,0,item[0]);
sel=1;
goto end;
case '2':
text(x,y+1,0,item[1]);
sel=2;
goto end;
case '3':
if(num>=3)
{
text(x,y+2,0,item[2]);
sel=3;
goto end;
}
else break;
case '4':
if(num>=4)
{
text(x,y+3,0,item[3]);
sel=4;
goto end;
}
else break;
case '5':
if(num>=5)
{
text(x,y+4,0,item[4]);
sel=5;
goto end;
}
else break;
case '6':
if(num>=6)
{
text(x,y+5,0,item[5]);
sel=6;
goto end;
}
else break;
case '7':
if(num>=7)
{
text(x,y+6,0,item[6]);
sel=7;
goto end;
}
else break;
case '8':
if(num==8)
{
text(x,y+7,0,item[7]);
sel=8;
goto end;
}
else break;
end:
textbackground(default_back);textcolor(default_fore);
return sel;
}
/*********************************Menus*************************************/
/********************************Menu To View Marks**************************/
void view()
{
int opt,i,reg,flag=0;
char n[20],ch;
view:
opt=menu(1,5,5,"1.View All","2.Search Reg No","3.Show Failers","4.Read From File"
,"5.Back","[","]", "Dispay Menu","=");
switch(opt)
{
case 1: //Show All Marks
for(i=0;i<10;i++)
{
clrscr();
if(s[i].redgno!=NULL)
{
cout<<" Report Card Of "<<s[i].name
<<"\nRegistration Number:"<<s[i].redgno<<"\nClass:"<<s[i].clas
<<"\nAddress:"<<s[i].address<<"\nFather's Name:"<<s[i].fname
<<"\nDate Of Birth:"<<s[i].dob.dd<<"-"<<s[i].dob.mm<<"-"<<s[i].dob.yyyy
<<"\nStream:"<<s[i].st_code<<"\n\n\
-------------------------------------------------------------------------------\
\nSubject Marks\n-------------\nSubject 1 :"
<<s[i].sub1<<"\nSubject 2 :"<<s[i].sub2<<"\nSubject 3 :"<<s[i].sub3
<<"\nSubject 4 :"<<s[i].sub4<<"\nSubject 5 :"<<s[i].sub5
<<"\nTotal :"<<s[i].total<<"\nGrade :"<<s[i].div;
cout<<"\n\nPress Any Key To Continue..";
getch();
}
else break;
}
break;
case 3:clrscr(); //Show Failers
for(i=0;i<records;i++)
{
if((s[i].sub1<33)||(s[i].sub2<33)||(s[i].sub3<33)||(s[i].sub4<33)||(s[i].sub5<33))
{
cout<<" Report Card Of "<<s[i].name
<<"\nRegistration Number:"<<s[i].redgno<<"\nClass:"<<s[i].clas
<<"\nAddress:"<<s[i].address<<"\nFather's Name:"<<s[i].fname
<<"\nDate Of Birth:"<<s[i].dob.dd<<"-"<<s[i].dob.mm<<"-"<<s[i].dob.yyyy
<<"\nStream:"<<s[i].st_code<<"\n\n\
-------------------------------------------------------------------------------\
\nSubject Marks\n-------------\nSubject 1 :"
<<s[i].sub1<<"\nSubject 2 :"<<s[i].sub2<<"\nSubject 3 :"<<s[i].sub3
<<"\nSubject 4 :"<<s[i].sub4<<"\nSubject 5 :"<<s[i].sub5
<<"\nTotal :"<<s[i].total<<"\nGrade :"<<s[i].div;
cout<<"\n\nPress Any Key To Continue...";
flag=1;
getch();
}
}
if(flag==0)
{
cout<<"No Failers Found";
getch();
view();
}
break;
case 2:clrscr(); //Search By Reg No
cout<<"\n\n\tEnter Number To Be Searched:";cin>>reg;
for(i=0;i<10;i++)
{
if(s[i].redgno==reg)
{
cout<<" Report Card Of "<<s[i].name
<<"\nRegistration Number:"<<s[i].redgno<<"\nClass:"<<s[i].clas
<<"\nAddress:"<<s[i].address<<"\nFather's Name:"<<s[i].fname
<<"\nDate Of Birth:"<<s[i].dob.dd<<"-"<<s[i].dob.mm<<"-"<<s[i].dob.yyyy
<<"\nStream:"<<s[i].st_code<<"\n\n\
-------------------------------------------------------------------------------\
\nSubject Marks\n-------------\nSubject 1 :"
<<s[i].sub1<<"\nSubject 2 :"<<s[i].sub2<<"\nSubject 3 :"<<s[i].sub3
<<"\nSubject 4 :"<<s[i].sub4<<"\nSubject 5 :"<<s[i].sub5
<<"\nTotal :"<<s[i].total<<"\nGrade :"<<s[i].div;
flag=1;
getch();
}
}
if(flag==0)
{
cout<<"Record Not Found";
getch();
view();
}
break;
case 4: //Read File
clrscr();
cout<<"\n\n\tEnter Name Of Student:";gets(n);
ifstream fil;
strcat(n,".txt");
fil.open(n);
while(!fil.eof())
{
fil.get(ch);
cout<<ch;
}
cout<<"\n\nPress Any Key To Continue...";
getch();
clrscr();
break;
case 5:student_menu(); //Exit
default:student_menu();
}
goto view;
}
/******************************Student Menu*********************************/
void student_menu()
{
textbackground(16);
textcolor(15);
unsigned int tredg;
char ch='y',ch1;
do
{
clrscr();
ch1=menu(1,5,3,"1.Add Students","2.Display Student","3.Back","","","[","] "
,"Student Menu","=");
switch(ch1)
{
case 1:clrscr(); //Marks
add();
break;
case 2:clrscr(); //View Marks
view();
break;
case 3:main_menu(); //Main Menu
getch();
break;
case 6:main_menu(); //Main Menu
getch();
break;
default:cout<<"\n\nWorng Choice!!";
}
cout<<"\n\nDo You Want to Continue?(Y/N)";
cin>>ch;
}
while(ch=='y'||ch=='Y');
main_menu();
}
/*********************************Main Menu**********************************/
void main_menu()
{
textbackground(16);
textcolor(LIGHTGRAY);
char ch1;
do{
clrscr();
/**********************************Marks Menu********************************/
void mark_menu()
{
textbackground(BLACK);
textcolor(WHITE);
int t_redg,i,opt,flag=0;
char ch='y',na[20];
do
{
clrscr();
gotoxy(1,25);
cout<<"Press Esc to Quit";
opt=menu(1,5,3,"1.Modify Student","2.Remove Student","3.Back",
"",""," [","] "," Menu","=");
switch(opt)
{
case 1: clrscr(); //Modify Student
mod();
getch();
mark_menu();
break;
case 2: clrscr(); //Delete Student
cout<<"Which Student Do you want to Delete\nEnter Reg No:";
cin>>t_redg;
for(i=0;i<10;i++)
{
if(s[i].redgno==t_redg)
{
strcat(na,s[i].name);
strcat(na,".txt");
if(remove(na)) cout<<"The Record of "<<s[i].name<<" is removed.";
else cout<<"Internal Error. "<<s[i].name<<" could not be removed.";
s[i].redgno = -1;
flag=1;
break;
}
}
if(flag==0)
cout<<"Record not found";
mark_menu();
break;
default:main_menu();
}
gotoxy(30,25);
cout<<"Do you want to Continue?(Y/N)...";
cin>>ch;
}while(ch=='y'||ch=='Y');
if(ch=='n'||ch=='N')
main_menu();
}
/******************************Main Function*********************************/
void main()
{
clrscr();
main_menu();
getch();
}
/************************************End*************************************/