📄 onlineadm.cpp
字号:
#include<graphics.h>
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#include<fstream.h>
#include<string.h>
#include<dos.h>
#include<math.h>
#include<stdio.h>
fstream v1,v2,v3;
class college
{
protected:
struct coll
{
char cname[10];
char course[5];
int seats;
float crange;
char category[6];
int state;
int internation;
int other;
}c,cc,col[2];
public:
college(){}
void write(int i,coll c2);
void insert();
void show();
};
void college:: insert()
{
v1.open("cc.txt",ios::out|ios::app);
cout<<"COLLEGE DETAILS:"<<"\n";
cout<<"^^^^^^^ ^^^^^^^"<<"\n";
cout<<"ENTER THE NAME OF COLLEGE :";
cin>>c.cname;
cout<<"\n"<<"ENTER THE COLLEGE CATEGORY(govt\priv\auto) :";
cin>>c.category;
for(int i=0;i<4;i++)
{
cout<<"\n"<<"\t"<<"COURSE:"<<"\t";
cin>>c.course;
cout<<"\n"<<"\t\t"<<"number of seats :";
cin>>c.seats;
cout<<"\n"<<"\t\t"<<"crange :";
cin>>c.crange;
cout<<"\n"<<"\t\t"<<"enter the state quota seats :";
cin>>c.state;
cout<<"\n"<<"\t\t"<<"enter the international quota seats :";
cin>>c.internation;
cout<<"\n"<<"\t\t"<<"enter the other quota seats :";
cin>>c.other;
v1.write((char*)&c,sizeof(c));
}
v1.close();
}
void college::show()
{
//static int i=0;
v1.open("cc.txt",ios::in);
cout<<"COLLEGE DETAILS:"<<"\n";
cout<<"^^^^^^^ ^^^^^^^"<<"\n";
cout<<"COLLEGE"<<" "<<"COURSE"<<" "<<"N.SEATS"<<" "<<"MINCUTOFF"<<" "<<"CATEGORY"<<" "<<"STATE Q."<<" "<<"NRI Q."<<" "<<"OSTATE Q."<<"\n";
cout<<"~~~~~~~"<<" "<<"~~~~~~"<<" "<<"~~~~~~~"<<" "<<"~~~~~~~~~"<<" "<<"~~~~~~~~"<<" "<<"~~~~~~~~"<<" "<<"~~~~~~"<<" "<<"~~~~~~~~~";
while(v1.read((char*)&cc,sizeof(c)))
{
cout<<"\n"<<cc.cname<<"\t "<<cc.course<<"\t "<<cc.seats<<"\t "<<cc.crange<<" \t"<<cc.category<<"\t "<<cc.state<<" \t"<<cc.internation<<" \t"<<cc.other<<"\n";
}
v1.close();
}
class student
{
protected:
struct stud
{
char name[10];
int total;
float cutoff;
int rank;
char division[10];
}s,ss;
public:
student(){}
void insert1();
void show1();
void upsdate1();
};
void student:: insert1()
{
v2.open("dd.txt",ios::out);//|ios::app);
for(int i=0;i<10;i++)
{
cout<<"Enter The Name Of student :";
cin>>s.name;
cout<<"\n"<<"\t"<<"Enter The The Total :";
cin>>s.total;
cout<<"\n"<<"\t"<<"enter cutoff :";
cin>>s.cutoff;
cout<<"\n"<<"\t"<<"enter the rank :";
cin>>s.rank;
cout<<"\n"<<"\t"<<"enter the division(nri\other\state) :";
cin>>s.division;
v2.write((char*)&s,sizeof(s));
}
v2.close();
}
void student::show1()
{
v2.open("dd.txt",ios::in);
cout<<"ADMISSION DETAILS:";
cout<<"\n"<<"~~~~~~~~~ ~~~~~~~"<<"\n";
cout<<"\n"<<"NAME"<<"\t\t"<<"TOTAL"<<"\t\t"<<"CUTOFF"<<"\t\t"<<"RANK"<<"\t\t"<<"DIVISION"<<"\n";
cout<<"~~~~"<<"\t\t"<<"~~~~~"<<"\t\t"<<"~~~~~~"<<"\t\t"<<"~~~~"<<"\t\t"<<"~~~~~~~~";
while(v2.read((char*)&ss,sizeof(ss)))
{
cout<<"\n";
cout<<ss.name<<"\t\t"<<ss.total<<"\t\t"<<ss.cutoff<<"\t\t"<<ss.rank<<"\t\t"<<ss.division;
cout<<"\n";
}
v2.close();
}
class veth;
class school:public virtual student
{
protected:
//char name[10];
struct sch
{
char schoname[10];
char sex[2];
char schol[5];
int maths;
int science;
int language;
float entrance;
int age;
}x,xx;
public:
void insert2();
void details();
};
void school::insert2()
{
//veth z;
v3.open("xx.txt",ios::out);
for(int i=0;i<5;i++)
{
cout<<"\n"<<"Enter name of student:";
cin>>x.schoname;
cout<<"\n"<<"\t"<<"Enter The sex Of student :";
cin>>x.sex;
cout<<"\n"<<"\t"<<"Enter The school :";
cin>>x.schol;
cout<<"\n"<<"\t"<<"enter maths marks(200) :";
cin>>x.maths;
cout<<"\n"<<"\t"<<"enter science marks(200) :";
cin>>x.science;
cout<<"\n"<<"\t"<<"enter language marks(200) :";
cin>>x.language;
cout<<"\n"<<"\t"<<"enter the entrance marks(100):";
cin>>x.entrance;
//x.age=z.get();
v3.write((char*)&x,sizeof(x));
}
v3.close();
}
void school::details()
{
char a[10];
cout<<"STUDENT DETAILS:";
cout<<"\n"<<"~~~~~~~ ~~~~~~~~";
cout<<"\n"<<"ENTER THE NAME OF STUDENT:";
cin>>a;
cout<<"\n";
cout<<"BIODATA OF MR."<<a<<":";
cout<<"\n"<<"~~~~~~~ ~~ ~~~"<<"\n";
v2.open("dd.txt",ios::in);
v3.open("xx.txt",ios::in);
cout<<"NAME"<<"\t"<<"SEX"<<"\t"<<"SCHOOL"<<"\t"<<"MATHS"<<"\t"<<"SCIENCE"<<"\t "<<"LANGUAGE"<<" "<<"ENTRANCE"<<" "<<"CUTOFF"<<"\n\n";
cout<<"~~~~"<<"\t"<<"~~~"<<"\t"<<"~~~~~~"<<"\t"<<"~~~~~"<<"\t"<<"~~~~~~~"<<"\t "<<"~~~~~~~~"<<" "<<"~~~~~~~~"<<" "<<"~~~~~~"<<"\n";
while(v2.read((char*)&ss,sizeof(ss)))
{
//cout<<"\n\n\n"<<xx.sex<<"\t"<<xx.schol;
if(!strcmpi(ss.name,a))
{
while(v3.read((char*)&xx,sizeof(xx)))
{
if(!strcmpi(xx.schoname,a))
{ //cout<<xx.schoname<<"1234";
cout<<ss.name<<"\t"<<xx.sex<<"\t"<<xx.schol<<"\t"<<xx.maths<<"\t"<<xx.science<<"\t "<<xx.language<<"\t "<<xx.entrance<<"\t "<<ss.cutoff<<"\n";
}
}
}
}
v3.close();
v2.close();
}
class admission: public college,public virtual student
{
public:
admission(){}
void comp(char *,char *);
void comp();
void disp();
void getcourse(char *);
};
void admission::getcourse( char *tem)
{
tem=new char[10];
char tem1[4];
v1.open("cc.txt",ios::in);
int i=0;
while(v1.read((char*)&cc,sizeof(cc)))
{
if(strcmp(tem,cc.cname))
{
if(cc.crange<ss.cutoff)
{
i++;
cout<<i<<")"<<"\t"<<cc.cname<<"------->"<<cc.course<<"\n";
//goto a;
}
}
}
cout<<"ENTER THE COURSE NAME"<<endl;
cin>>tem1;
comp(tem,tem1);
}
void admission::disp()
{
char temp[10];
v1.open("cc.txt",ios::in);
v2.open("dd.txt",ios::in);
cout<<"REGISTRATION MODULE";
cout<<"you can select one of these colleges:"<<"\n";
int i=0,k=0;
while(v2.read((char*)&ss,sizeof(ss)))
{
int j=0;
while(v1.read((char*)&cc,sizeof(cc)))
{
if(cc.crange<ss.cutoff)
{ j++;
i++;
if(i%4==0)
{ k++;
cout<<k<<")"<<cc.cname<<endl;
}
}
}
}
v1.close();
v2.close();
cout<<"ENTER THE COLLEGE NAME"<<endl;
cin>>temp;
getcourse(temp);
}
void admission::comp(char *a,char *b)
{
a=new char[10];
b=new char[10];
v2.open("dd.txt",ios::in);
m:
while(v2.read((char*)&ss,sizeof(ss)))
{
v1.open("cc.txt",ios::in);
int i=0;
while(v1.read((char*)&cc,sizeof(cc)))
{
i++;
if(!strcmpi(cc.cname,a))
{
if(!strcmpi(cc.course,b)&&cc.crange<ss.cutoff&&cc.seats>0)
{
cc.seats--;
cout<<endl<<cc.seats<<"\n";
cout<<"CONGRATULATIONS"<<"\n";
v1.close();
write(i,cc);
goto m;
}
else
{
v1.close();
continue;
}
}
}
}
v2.close();
}
void admission::comp()
{
char col[10],co[10];
v2.open("dd.txt",ios::in);
int i=0;
m:
while(v2.read((char*)&ss,sizeof(ss)))
{
cout<<"COLLEGE ADMISSION"<<"\n";
cout<<"^^^^^^^^^^^^^^^^^";
cout<<"NAME OF STUDENT:"<<ss.name<<"\n";
cout<<"ENTER THE COL NAME:";
cin>>col;
cout<<"ENTER THE COURSE NAME:";
cin>>co;
v1.open("cc.txt",ios::in);
i=0;
while(v1.read((char*)&cc,sizeof(cc)))
{
i++;
if(!strcmpi(cc.cname,col))
{
if(cc.seats>0)
{
if(!strcmpi(cc.course,co)&&cc.crange<ss.cutoff)
{
cc.seats--;
cout<<endl<<cc.seats<<"\n";
cout<<" congratulations mr."<<ss.name<<" has been admt in "<<cc.cname<<" in "<<cc.course<<" department"<<"\n";
if(cc.state)
{
if(!strcmp(ss.division,"state"))
cc.state--;
}
//else
if(cc.internation)
{
if(!strcmp(ss.division,"nri"))
cc.internation--;
}
// else
//cout<<"SEATS ARE NOT AVALABLE";
if(!cc.other)
{
if(!strcmp(ss.division,"other"))
{cc.other--;}
}
// else
// cout<<"SEATS ARE NOT AVAILABLE:";
v1.close();
write(i,cc);
goto m;
}
else
{
v1.close();
continue;
}
}
else
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -