📄 onlineadm.cpp
字号:
cout<<" you cannot have seat in this college:"<<cc.cname<<"\n";
cout<<"try another college:"<<"\n";
}
}
}
}
v2.close();
}
void college::write(int i,coll c1)
{
fstream f;
v1.open("cc.txt",ios::in);
f.open("tmp.txt",ios::out);
for(int j=1;j<i;j++)
{
v1.read((char*)&cc,sizeof(cc));
f.write((char*)&cc,sizeof(cc));
}
v1.read((char*)&cc,sizeof(cc));
f.write((char*)&c1,sizeof(c1));
while(v1.read((char*)&cc,sizeof(cc)))
f.write((char*)&cc,sizeof(cc));
f.close();
v1.close();
v1.open("cc.txt",ios::out);
f.open("tmp.txt",ios::in);
while(f.read((char*)&cc,sizeof(cc)))
v1.write((char*)&cc,sizeof(cc));
f.close();
v1.close();
}
class flist:public admission,public school
{
protected:
int tseats;
public:
void operator+();
friend void fprint(flist a);
void printnc();
};
void flist::printnc()
{
v2.open("dd.txt",ios::in);
while(v2.read((char*)&ss,sizeof(ss)))
{
cout<<ss.name<<"----->"<<ss.cutoff;
}
v2.close();
}
void fprint(flist a)
{
//cin>>a.tseats;
cout<<a.tseats;
}
void flist::operator+()
{
v1.open("cc.txt",ios::in);
tseats =0;
while(v1.read((char*)&cc,sizeof(cc)))
{
tseats+=cc.seats;
v1.close();
}
cout<<"\n"<<"TOTAL NUMBER OF SEATS IN ENGINEERING COLLEGE:";
cout<<tseats<<"\n";
cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^";
}
template<class t1,class t2>
class fref:public student
{
t1 a;
t2 b;
public:
fref(t1 x,t2 y)
{ a=x;
b=y;
cout<<"\n"<<a;
cout<<"\t"<<b;
}
};
void start(void)
{
setcolor(RED);
setlinestyle(SOLID_LINE,1,3);
rectangle(2,2,639,479); // RECTANGLE WHICH IS THE BORDER
setcolor(BLUE);
setlinestyle(SOLID_LINE,1,2); // ... COLORS ARE USED IN THEM..
rectangle(10,10,629,469);
}
int Password (void)
{
char Password[12]="v"; // Already assigned password
char pass[20];
char UserName[15];
char user[15]="v";
int sucess=0; // Password Verification
int x=26,i;
cleardevice();
start();
setcolor(YELLOW);
line ( 130, 180, 500, 180 ); // creates..
rectangle ( 130, 150, 500, 300 );
setfillstyle ( SOLID_FILL, 7 ); // ..the dialouge box..
bar ( 130, 150, 500, 180 );
setfillstyle ( SOLID_FILL, 8 ); // ..where password and user name..
bar ( 130, 180, 500, 300 );
setcolor ( 4 ); // ..can be entered
outtextxy ( 140, 165, " P A S S W O R D V E R I F I C A T I O N " );
setfillstyle ( SOLID_FILL, 0 );
bar ( 200, 200, 450, 230 );
bar ( 200, 247, 450, 277 );
outtextxy ( 130, 210, " NAME " );
outtextxy ( 126, 258, " PASSWORD " );
gotoxy(26,14);
gets(UserName);
for(i=0;i<20;i++ ) // Gets the password..
{
pass[i]=getch(); // ..until enter key is not pressed..
if(pass[i]=='\r')
{
pass[i]='\0'; // Enter a NULL character
break;
}
else
{
gotoxy(x,17);printf("*"); // ..and prints asterix on the screen
x++;
}
}
if ((strcmp(Password,pass)==0)&&(strcmp(UserName,user)==0)) // checks password character..
sucess=1;
else // If incorrect password
{
sucess=0;
gotoxy (22, 21);
printf ( " INVALID PASSWORD! TRY AGAIN " );
getche ();
}
return ( sucess );
}
void end2(void)
{
int driver=DETECT,mode; //detect best driver and mode
int i,j=520;
initgraph(&driver,&mode,"c:\\tc\\bgi"); //initialize graphics mode
for(i=480;i>=0;i--)
{
setcolor(WHITE);
outtextxy(230,i,"DESIGNED BY");
outtextxy(230,j+30,"vinodhrajkumar.s");
outtextxy(230,j+45,"raghupathy.m");
outtextxy(230,j+60,"siddharth.s");
outtextxy(243,j+120,"CSE H-Batch");
outtextxy(243,j+140,"CEG");
delay(20);
j--;
cleardevice();
}
closegraph();
}
void main(void)
{
int Proceed;
int driver=VGA,mode=VGAHI; //detect best driver and mode
initgraph(&driver,&mode,"E:\\TC\\bgi"); //initialize graphics mode
//randomize();
cleardevice();
// AND THEM CHECK
// do
// {
// Proceed = Password(); // CHECK THE PASSWORD
// } while ( Proceed!=1);
cleardevice();
//start();
//menu();
// int gdriver = DETECT, gmode, errorcode;
int midx, midy;
midx = getmaxx() / 2;
midy = getmaxy() / 2;
settextjustify(CENTER_TEXT, CENTER_TEXT);
cleardevice();
settextstyle(4,0,6);
setcolor(12);
setbkcolor(1);
//cprintf("vinodh");
outtextxy(midx,midy,"ONLINE ADMISSION...." );
getch();
cleardevice();
closegraph();
//setbkcolor(6);
clrscr();
college a;
student b;
admission c;
flist d;
//fprint(d);
school e;
fref<char*,int> r("colleges",5);
//a.show();
//a.insert();
//clrscr();
//a.show();
//getch();
//clrscr();
//delay(1000);
//clrscr();
//b.insert1();
//cleardevice();
//b.show1();
//getch();
//clrscr();
//delay(1000);
//clrscr();
//e.insert2();
//c.comp();
//e.details();
//+d;
//a.show();
+d;
initgraph(&driver,&mode,"E:\\TC\\bgi"); //initialize graphics mode
midx = getmaxx() / 2;
midy = getmaxy() / 2;
settextjustify(CENTER_TEXT, CENTER_TEXT);
cleardevice();
settextstyle(4,0,3);
setcolor(12);
setbkcolor(1);
//cprintf("vinodh");
//outtextxy(midx, midy,"ONLINE ADMISSION...." );
// getch();
n:
outtextxy(250,100,"1.press 1 to see ur position");
outtextxy(250,150,"2.press 2 for admission");
outtextxy(250,200,"3.press 3 to goto back");
outtextxy(250,250,"4.press 4 for student details");
outtextxy(250,300,"5.press 5 for college availabilities");
outtextxy(250,350,"6.press 6 for student order");
outtextxy(250,400,"7.press 7 to see remaining engineering seats");
getch();
//delay(1000);
//cleardevice();
closegraph();
switch (getch())
{
case '1':
c.disp();
break;
case '2':
c.comp();
break;
case '3':
goto n;
case '4':
e.details();
break;
case '5':
clrscr();
a.show();
getch();
break;
case '6':
clrscr();
b.show1();
getch();
break;
case '7':
+d;
break;
default:
{
clrscr();
initgraph(&driver,&mode,"E:\\TC\\bgi"); //initialize graphics mode
midx = getmaxx() / 2;
midy = getmaxy() / 2;
settextjustify(CENTER_TEXT, CENTER_TEXT);
cleardevice();
settextstyle(4,0,3);
setcolor(12);
setbkcolor(1);
//cprintf("vinodh");
//outtextxy(midx, midy,"ONLINE ADMISSION...." );
// getch();
int x;
outtextxy(midx,100,"enter correct option");
outtextxy(midx,150,"enter 0 to exit:");
outtextxy(midx,200,"enter 9 to enter correct option:");
cin>>x;
if(x==0)
{cleardevice();
outtextxy(midx,150,"have a good day");
getch();
}
else
{ cleardevice();
outtextxy(midx,450,"press valid option") ;
goto n;
}
closegraph();
}
}
//a.show();
//getch();
//closegraph();
initgraph(&driver,&mode,"E:\\TC\\bgi");
end2();
closegraph();
getch();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -