Dec 4, 2013 at 4:03am UTC
HERE ARE TWO ASSISTANT FUNCTIONS :(I CALL modifydata() from main, when needed)
void modifyhelp()
{
char nDOB[10],nCNC[10],nN[50],nFN[50],nMN[50],nPE[2],nWE[2];
int nTEN,nTM,nTP,nTC,nTCS,nPEN,nPP,nPC,nPM,nPCS;
clrscr();
setfillstyle(EMPTY_FILL,CYAN);
floodfill(320,240,CYAN);
gotoxy(10,13);
cout<<" Do you want to Change anything??(Y/N) ";
gotoxy(10,55);
char z[1];
gets(z);
if((strcmp(z,"Y")==0)||(strcmp(z,"y")==0))
{ clrscr();
setfillstyle(EMPTY_FILL,CYAN);
floodfill(320,240,CYAN);
{ settextstyle(SMALL_FONT,HORIZ_DIR,8);
settextjustify(LEFT_TEXT,CENTER_TEXT);
outtextxy(70,40,"Enter New Details for the Student");
}
line(60,55,560,55);
rectangle(155,150,340,280);
{ settextstyle(SMALL_FONT,HORIZ_DIR,4);
settextjustify(LEFT_TEXT,BOTTOM_TEXT);
outtextxy(350,173,"(Press '.' to retain old values)");
gotoxy(13,11); cout<<"D.O.B :";
gotoxy(5,13); cout<<"Student's Name:";
gotoxy(6,15); cout<<"Mother's Name:";
gotoxy(6,17); cout<<"Father's Name:";
gotoxy(23,11); gets(nDOB);
outtextxy(350,206,"(Press '.' to retain old values)");
gotoxy(23,13); gets(nN);
outtextxy(350,239,"(Press '.' to retain old values)");
gotoxy(23,15); gets(nMN);
outtextxy(350,272,"(Press '.' to retain old values)");
gotoxy(23,17); gets(nFN);
rectangle(10,310,getmaxx()-10,getmaxy()-10);
gotoxy(25,21); cout<<"INTERNAL ASSESMENT SUBJECTS";
outtextxy(430,360,"(Press '.' to retain old values)");
gotoxy(23,23); cout<<"Character and Conduct:";
gotoxy(5,25); cout<<"Physical Education:";
gotoxy(50,25); cout<<"Work Experience:";
gotoxy(46,23); gets(nCNC);
outtextxy(100,410,"(Press '.' to retain old values)");
gotoxy(25,25); gets(nPE);
outtextxy(430,410,"(Press '.' to retain old values)");
gotoxy(67,25); gets(nWE);
}
clrscr();
setfillstyle(EMPTY_FILL,CYAN);
floodfill(320,240,CYAN);
rectangle(0,0,getmaxx(),getmaxy());
rectangle(5,5,getmaxx()-5,getmaxy()-5);
line(5,80,getmaxx()-5,80);
line(200,80,200,390);
line(420,80,420,390);
line(5,140,getmaxx()-5,140);
line(5,180,getmaxx()-5,180);
line(5,240,getmaxx()-5,240);
line(5,290,getmaxx()-5,290);
line(5,340,getmaxx()-5,340);
line(5,390,getmaxx()-5,390);
int a = retsec();
{ settextstyle(SMALL_FONT,HORIZ_DIR,8);
settextjustify(LEFT_TEXT,BOTTOM_TEXT);
outtextxy(60,30,"M.G.M. H.S. SCHOOL STUDENT SCORECARD");
}
{ settextstyle(SMALL_FONT,HORIZ_DIR,4);
settextjustify(LEFT_TEXT,BOTTOM_TEXT);
gotoxy(15,7); cout<<"SUBJECT";
gotoxy(35,7); cout<<"THEORY";
gotoxy(55,7); cout<<"PRACTICAL";
gotoxy(15,11); cout<<"ENGLISH";
gotoxy(15,14); cout<<"PHYSICS";
gotoxy(13,17); cout<<"CHEMISTRY";
gotoxy(12,20); cout<<"MATHEMATICS";
gotoxy(14,23);
if(a==1)
cout<<"COMP. SC.";
else if(a==2)
{ gotoxy(3,23);
cout<<"INFORMATICS PRACTICE.";
}
else if(a==3)
cout<<"ECONOMICS";
else if(a==4)
{ gotoxy(9,23);
cout<<"Phy. EDUCATION";
}
else if(a==7)
cout<<"BIOLOGY";
outtextxy(320,173,"(101 :retain old)");
gotoxy(35,11); cin>>nTEN;
outtextxy(320,216,"(101:retain old)");
gotoxy(35,14); cin>>nTP;
outtextxy(320,269,"(101:retain old)");
gotoxy(35,17); cin>>nTC;
outtextxy(320,317,"(101:retain old)");
gotoxy(35,20); cin>>nTM;
outtextxy(320,365,"(101:retain old)");
gotoxy(35,23); cin>>nTCS;
outtextxy(490,173,"(101:retain old)");
gotoxy(55,11); cin>>nPEN;
outtextxy(490,216,"(101:retain old)");
gotoxy(55,14); cin>>nPP;
outtextxy(490,269,"(101:retain old)");
gotoxy(55,17); cin>>nPC;
outtextxy(490,317,"(101:retain old)");
gotoxy(55,20); cin>>nPM;
outtextxy(490,366,"(101:retain old)");
gotoxy(55,23); cin>>nPCS;
}
}
if(strcmp(nDOB,".")!=0)
strcpy(DOB,nDOB);
if(strcmp(nCNC,".")!=0)
strcpy(CNC,nCNC);
if(strcmp(nWE,".")!=0)
strcpy(WE,nWE);
if(strcmp(nPE,".")!=0)
strcpy(PE,nPE);
if(strcmp(nN,".")!=0)
strcpy(N,nN);
if(strcmp(nMN,".")!=0)
strcpy(MN,nMN);
if(strcmp(nFN,".")!=0)
strcpy(FN,nFN);
if(nTEN!=101)
TEN=nTEN;
if(nTP!=101)
TP=nTP;
if(nTC!=101)
TC=nTC;
if(nTM!=101)
TM=nTM;
if(nTCS!=101)
TCS=nTCS;
if(nPEN!=101)
PEN=nPEN;
if(nPP!=101)
PP=nPP;
if(nPM!=101)
PM=nPM;
if(nPC!=101)
PC=nPC;
if(nPCS!=101)
PCS=nPCS;
calculate();
}
void modifydata()
{
setbkcolor(BLUE);
int x=0,pos;
char n;
ifstream ifile;
ofstream ofile;
progress o1,o2,o;
ifile.open("khabari.txt", ios::in|ios::binary);
ofile.open("temp.txt",ios::out|ios::binary);
o1.getrno();
o1.getclass();
int rn=o1.retroll();
int C =o1.retclass();
int S =o1.retsec();
ifile.seekg(0);
while(ifile)
{
ifile.read((char*)&o2, sizeof(progress));
if((o2.retroll()==rn)&&(o2.retclass()==C)&&(o2.retsec()==S))
{ clrscr();
setfillstyle(EMPTY_FILL,CYAN);
floodfill(320,240,CYAN);
{ settextstyle(SMALL_FONT,HORIZ_DIR,8);
settextjustify(LEFT_TEXT,CENTER_TEXT);
outtextxy(30,200,"HERE'S THE ORIGNAL STUDENT PROGRESS CARD");
}
delay(4000);
clrscr();
setfillstyle(EMPTY_FILL,CYAN);
floodfill(320,240,CYAN);
o2.putdata();
getch();
o2.modifyhelp();
o2.calculate();
ofile.write((char*)&o2,sizeof(progress)); //turbo c++ stops responding here
x=x+1;
}
else
ofile.write((char*)&o2,sizeof(progress));
}
ifile.close();
ofile.close();
clrscr();
setfillstyle(EMPTY_FILL,CYAN);
floodfill(320,240,CYAN);
{ settextstyle(SMALL_FONT,HORIZ_DIR,8);
settextjustify(LEFT_TEXT,CENTER_TEXT);
outtextxy(40,200,"GETTING THINGS READY PLEASE WAIT ....");
}
delay(4000);
ifile.open("temp.txt",ios::in|ios::binary);
ofile.open("khabari.txt",ios::out|ios::binary);
while(ifile)
{
ifile.read((char*)&o2,sizeof(progress));
ofile.write((char*)&o2,sizeof(progress));
}
ifile.close();
ofile.close();
if(x==0)
{ clrscr();
setfillstyle(EMPTY_FILL,CYAN);
floodfill(320,240,CYAN);
setcolor(WHITE+BLINK);
{ settextstyle(SMALL_FONT,HORIZ_DIR,8);
settextjustify(LEFT_TEXT,CENTER_TEXT);
outtextxy(200,200,"RECORD DOES NOT EXIST!!!");
}
delay(4000);
clrscr();
setfillstyle(EMPTY_FILL,CYAN);
floodfill(320,240,CYAN);
modifydata();
}
else
{
clrscr();
setfillstyle(EMPTY_FILL,CYAN);
floodfill(320,240,CYAN);
{ settextstyle(SMALL_FONT,HORIZ_DIR,8);
settextjustify(LEFT_TEXT,CENTER_TEXT);
outtextxy(40,200," HERE'S THE MODIFIED PROGRESS CARD");
}
delay(4000);
ifile.open("khabari.txt",ios::in|ios::binary);
ifile.seekg(0);
while(ifile)
{
ifile.read((char*)&o2, sizeof(progress));
if((o2.retroll()==rn)&&(o2.retclass()==C)&&(o2.retsec()==S))
{ clrscr();
setfillstyle(EMPTY_FILL,CYAN);
floodfill(320,240,CYAN);
o2.putdata();
getch();
}
}
}
ifile.close();
}
Last edited on Dec 4, 2013 at 6:39am UTC