C++

C++ Project on Report Card Making

Report Card Making

#include
#include
#include
#include
#include
#include
#include
#include

ofstream r; ifstream t;

void credits(); void menu1(); void menu2(); void menu3(); void terms();

class xii

{
 public:
 int roll;
 char na[20];
 int m1,m2,m3,m4,m5;
 char g[10];
 int t;
 int p;
 void input()
  {
   gotoxy(1,5);
   cout< <"\tENTER ROLL NUMBER OF THE STUDENT :";
   cin>>roll;
   cout< <"\tENTER NAME OF THE STUDENT :";
   gets(na);
   cout<<"\n\n\tENTER MARKS OF THE 5 SUBJECTS OUT OF 100";
   cout<<"\n";
   cout<<"\tENTER MARKS IN ENGLISH:";
   cin>>m1;
   cout< <"\n";
   cout<<"\tENTER MARKS IN MATHS:";
   cin>>m2;
   cout< <"\n";
   cout<<"\tENTER MARKS IN PHYSICS:";
   cin>>m3;
   cout< <"\n";
   cout<<"\tENTER MARKS IN CHEMISTRY:";
   cin>>m4;
   cout< <"\n";
   cout<<"\tENTER MARKS IN COMPUTER:";
   cin>>m5;
   cout< <"\n";
   cleardevice();
   t=m1+m2+m3+m4+m5;
   p=t/5;
   gotoxy(1,1);
  }

  void output()
   {
   cout<<"\n";
   cout<<" "<>n;

cleardevice(); for(i=0;i=95)

strcpy(s[i].g,"A1");

if(s[i].p>=90&&s[i].p<95)

strcpy(s[i].g,"A2");

if(s[i].p>=80&&s[i].p<90)

strcpy(s[i].g,"B1");

if(s[i].p>=70&&s[i].p<80)

strcpy(s[i].g,"B2");

if(s[i].p>=60&&s[i].p<70)

strcpy(s[i].g,"C1");

if(s[i].p>=50&&s[i].p<60)

strcpy(s[i].g,"C2");

if(s[i].p>=40&&s[i].p<50)

strcpy(s[i].g,"D1");

if(s[i].p<40)

strcpy(s[i].g,"D2");

r.write((char*)&s[i],sizeof(s[i])); } }

void append() { clrscr(); cleardevice(); cout< <”\n”; int k; cout<<”\t\t\t-----------“<<”\n”; cout<<”\t\t\t| APPENDING |”<<”\n”; cout<<”\t\t\t-----------“<<”\n”<<”\n”; cout<<”\tENTER THE NUMBER OF RECORDS TO BE APPENDED :“; cin>>k; for(i=0;i=95)

strcpy(s[i].g,"A1");

if(s[i].p>=90&&s[i].p<95)

strcpy(s[i].g,"A2");

if(s[i].p>=80&&s[i].p<90)

strcpy(s[i].g,"B1");

if(s[i].p>=70&&s[i].p<80)

strcpy(s[i].g,"B2");

if(s[i].p>=60&&s[i].p<70)

strcpy(s[i].g,"C1");

if(s[i].p>=50&&s[i].p<60)

strcpy(s[i].g,"C2");

if(s[i].p>=40&&s[i].p<50)

strcpy(s[i].g,"D1");

if(s[i].p<40)

strcpy(s[i].g,"D2");

r.write((char*)&s[i],sizeof(s[i])); } getch(); n+=k; }

void search() { clrscr(); cleardevice(); char name[20]; int flag=0; cout< <”\n”; cout<<”\t\t\t-----------“<<”\n”; cout<<”\t\t\t| SEARCHING |”<<”\n”; cout<<”\t\t\t-----------“<<”\n”<<”\n”;

step: cout<<”\n\tENTER THE NAME TO BE SEARCHED :“; gets(name); cout<<”\n”; cout<<“ROLL NAME MARKS PERCENTAGE GRADE”<<”\n”; for(i=0;i=50.0&&s[i].p<60.0)

strcpy(s[i].g,"C2");

if(s[i].p>=40.0&&s[i].p<50.0)

strcpy(s[i].g,"D1");

if(s[i].p<40.0)

strcpy(s[i].g,"Failed");

r.write((char*)&s[i],sizeof(s[i])); s[i].output(); } getch(); }

void sort() { clrscr(); cleardevice(); xii tp; cout< <”\t\t\t-------------“<<”\n”; cout<<”\t\t\t| SORTED LIST |”<<”\n”; cout<<”\t\t\t-------------“<<”\n”<<”\n”; cout<<“ROLL NAME MARKS PERCENTAGE GRADE”<<”\n”; cout<<”---------------------------------------------------------”<<”\n”; for(i=0;i0)

 {	   tp=s[i];
   s[i]=s[j];
   s[j]=tp;
 }
}

} for(i=0;i=2) {

s[i].output();

} } getch(); }

void reads() { clrscr(); cleardevice(); cout< <”\n”; cout<<”\t------------------------------------------------“<<”\n”; cout<<”\t|| THE REPORT CARD OF STUDENTS OF CLASS XII-B2 ||”<<”\n”; cout<<”\t------------------------------------------------“<<”\n”<<”\n”; cout<<“ROLL NAME MARKS PERCENTAGE GRADE”<<”\n”; cout<<”--------------------------------------------------------”<<”\n”; for(i=0;i28;i--) { gotoxy(i,8); cout< <“Navi”; delay(70); } for(i=70;i>28;i--) { gotoxy(i,10); cout< <“www.Navi.com”; delay(70); } gotoxy(28,25); cout<<“Press any key to exit…”; getch(); exit(0); }

/********************************menu1*********************************/

void menu1() { cleardevice(); char ch; back: settextstyle(GOTHIC_FONT,VERT_DIR,5); settextjustify(LEFT_TEXT,CENTER_TEXT); outtextxy(50,240,“REPORT CARD”); settextstyle(SANS_SERIF_FONT,VERT_DIR,4); setbkcolor(BLACK); settextjustify(LEFT_TEXT,CENTER_TEXT); outtextxy(110,240,“Ist TERM”); settextstyle(SANS_SERIF_FONT,HORIZ_DIR,4); outtextxy(290,50,“1.MAKE REPORT CARD”); outtextxy(290,90,“2.APPEND NAMES”); outtextxy(290,130,“3.SORT NAMES”); outtextxy(290,170,“4.SEARCH A NAME”); outtextxy(290,210,“5.UPDATE GRADE”); outtextxy(290,250,“6.VIEW REPORT CARD”); outtextxy(290,290,“7.LIST OF FAILURES”); outtextxy(290,330,“8.MAIN MENU”); settextstyle(SANS_SERIF_FONT,HORIZ_DIR,3); outtextxy(400,420,“ENTER CHOICE”); ch=getch();

switch(ch) { case ‘1’: r.open(“report_1”); writes(); r.close(); cleardevice(); goto back;

case ‘2’: r.open(“report_1”,ios::app|ios::out); append(); r.close(); cleardevice(); goto back;

case ‘3’: t.open(“report_1”); sort(); t.close(); cleardevice(); goto back;

case ‘4’: t.open(“report_1”); search(); t.close(); cleardevice(); goto back;

case ‘5’: r.open(“report_1”,ios::end); update(); r.close(); cleardevice(); goto back;

case ‘6’: t.open(“report_1”); reads(); t.close(); cleardevice(); goto back;

case ‘7’: t.open(“report_1”); failed(); t.close(); cleardevice(); goto back;

case ‘8’: closegraph(); terms();

default :clrscr(); cleardevice(); settextstyle(TRIPLEX_FONT,HORIZ_DIR,5); outtextxy(220,240,“WRONG CHOICE !”); outtextxy(190,280,“PLEASE TRY AGAIN.”); sleep(2); cleardevice(); goto back; } }

/************************************menu2*****************************************/ void menu2() { cleardevice(); char ch; back: settextstyle(GOTHIC_FONT,VERT_DIR,5); settextjustify(LEFT_TEXT,CENTER_TEXT); outtextxy(50,240,“REPORT CARD”); settextstyle(SANS_SERIF_FONT,VERT_DIR,4); setbkcolor(BLACK); settextjustify(LEFT_TEXT,CENTER_TEXT); outtextxy(110,240,“IInd TERM”); settextstyle(SANS_SERIF_FONT,HORIZ_DIR,4); outtextxy(290,50,“1.MAKE REPORT CARD”); outtextxy(290,90,“2.APPEND NAMES”); outtextxy(290,130,“3.SORT NAMES”); outtextxy(290,170,“4.SEARCH A NAME”); outtextxy(290,210,“5.UPDATE GRADE”); outtextxy(290,250,“6.VIEW REPORT CARD”); outtextxy(290,290,“7.LIST OF FAILURES”); outtextxy(290,330,“8.MAIN MENU”); settextstyle(SANS_SERIF_FONT,HORIZ_DIR,3); outtextxy(400,420,“ENTER CHOICE”); ch=getch();

switch(ch) { case ‘1’: r.open(“report_2”); writes(); r.close(); cleardevice(); goto back;

case ‘2’: r.open(“report_2”,ios::app|ios::out); append(); r.close(); cleardevice(); goto back;

case ‘3’: t.open(“report_2”); sort(); t.close(); cleardevice(); goto back;

case ‘4’: t.open(“report_2”); search(); t.close(); cleardevice(); goto back;

case ‘5’: r.open(“report_2”,ios::end); update(); r.close(); cleardevice(); goto back;

case ‘6’: t.open(“report_2”); reads(); t.close(); cleardevice(); goto back;

case ‘7’: t.open(“report_2”); failed(); t.close(); cleardevice(); goto back;

case ‘8’: closegraph(); terms();

default :clrscr(); cleardevice(); settextstyle(TRIPLEX_FONT,HORIZ_DIR,5); outtextxy(220,240,“WRONG CHOICE !”); outtextxy(190,280,“PLEASE TRY AGAIN.”); sleep(2); cleardevice(); goto back; } }

/******************************menu3***********************************/ void menu3() { cleardevice(); char ch; back: settextstyle(GOTHIC_FONT,VERT_DIR,5); settextjustify(LEFT_TEXT,CENTER_TEXT); outtextxy(50,240,“REPORT CARD”); settextstyle(SANS_SERIF_FONT,VERT_DIR,4); setbkcolor(BLACK); settextjustify(LEFT_TEXT,CENTER_TEXT); outtextxy(110,240,“IIIrd TERM”); settextstyle(SANS_SERIF_FONT,0,4); outtextxy(290,50,“1.MAKE REPORT CARD”); outtextxy(290,90,“2.APPEND NAMES”); outtextxy(290,130,“3.SORT NAMES”); outtextxy(290,170,“4.SEARCH A NAME”); outtextxy(290,210,“5.UPDATE GRADE”); outtextxy(290,250,“6.VIEW REPORT CARD”); outtextxy(290,290,“7.LIST OF FAILURES”); outtextxy(290,330,“8.MAIN MENU”); settextstyle(SANS_SERIF_FONT,0,3); outtextxy(400,420,“ENTER CHOICE”); ch=getch();

switch(ch) { case ‘1’: r.open(“report_3”); writes(); r.close(); cleardevice(); goto back; case ‘2’: r.open(“report_3”,ios::app|ios::out); append(); r.close(); cleardevice(); goto back;

case ‘3’: t.open(“report_3”); sort(); t.close(); cleardevice(); goto back;

case ‘4’: t.open(“report_3”); search(); t.close(); cleardevice(); goto back;

case ‘5’: r.open(“report_3”,ios::end); update(); r.close(); cleardevice(); goto back;

case ‘6’: t.open(“report_3”); reads(); t.close(); cleardevice(); goto back;

case ‘7’: t.open(“report_3”); failed(); t.close(); cleardevice(); goto back;

case ‘8’: closegraph(); terms();

default :clrscr(); cleardevice(); settextstyle(TRIPLEX_FONT,HORIZ_DIR,5); outtextxy(220,240,“WRONG CHOICE !”); outtextxy(190,280,“PLEASE TRY AGAIN.”); sleep(2); cleardevice(); goto back; } }

/*******************************main***********************************/ void main() { int gdriver = DETECT, gmode, errorcode; initgraph(&gdriver,&gmode,“c:\tc\bgi”); errorcode = graphresult(); if (errorcode != grOk) /an error occurred/ { printf(“Graphics error: %s\n”, grapherrormsg(errorcode)); printf(“Press any key to halt:”); getch; exit(1); /* terminate with an error code */ }

settextstyle(SANS_SERIF_FONT,HORIZ_DIR,5); rectangle(1,1,getmaxx(),getmaxy()); setbkcolor(9); outtextxy(300,100,“A”); delay(2000); outtextxy(200,170,“PROJECT ON”); delay(2000); outtextxy(95,240,“REPORT CARD MAKING”); delay(2000); for(int i=0;i<360;i++) { ellipse(320,240,0,i,300,200); delay(12); } closegraph(); terms(); }

Share: