0% found this document useful (0 votes)
38 views3 pages

Include

The document defines structures and functions for a student admission system. It defines structures for admission criteria, administrator credentials, and student data. It also defines functions for inputting and reading criteria and student data, allotting streams to students based on eligibility, displaying information, and creating merit lists. The main function implements a menu-driven system allowing administrator and user functions like modifying criteria, entering student data, allotting streams, and displaying results.

Uploaded by

Suchita Gaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views3 pages

Include

The document defines structures and functions for a student admission system. It defines structures for admission criteria, administrator credentials, and student data. It also defines functions for inputting and reading criteria and student data, allotting streams to students based on eligibility, displaying information, and creating merit lists. The main function implements a menu-driven system allowing administrator and user functions like modifying criteria, entering student data, allotting streams, and displaying results.

Uploaded by

Suchita Gaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

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

struct marks_criteria { int


sc_min,com_min,arts_min, seat_sc, seat_com, seat_arts; } crit; struct administrator { char
user_name[10]; char password[10]; }admin; struct student { char name[20]; int
regno,m_eng,m_math,m_sc,m_sst,m_lang; int pref_code, stream; // Sc=1, Com=2; Arts=3; public:
void new_file(); void input_data(); void allot_stream(); int get_stream(); void display(); int
show_per() { return((m_eng+m_math+m_sc+m_sst+m_lang)/5); } }; void welcome(); void menu();
int verify_password(); void assign_user(); void clear(); void input_criteria(); void read_criteria(); void
read_student(); void create_eligible_sc(); void create_eligible_com(); void create_eligible_arts();
void read_eligible_sc(); void read_eligible_com(); void read_eligible_arts(); char * stream_name(int
strm); void select_list( char *in_file, char *out_file); void thanks(); student s; void main() { clrscr();
welcome(); // cout< <"welcome"; fstream fin, fout; fstream fsc, fcom, farts; char opt='1',
ch; while(opt!='8') { textmode(C80); textcolor(BLUE); textbackground(WHITE); clrscr();
cout<<"\n\t====================== MAIN MENU =======================\n"; cout<<"\n\t[1]
CREATE / MODIFY ADMISSION CRITERIA(Administrator only)"; cout<<"\n\n\t[2] ENTER STUDENT'S
DATA "; cout<<"\n\n\t[3] ALLOTMENT OF STREAM"; cout<<"\n\n\t[4] DISPLAY CRITERIA FOR
SELECTION"; cout<<"\n\n\t[5] DISPLAY ALLOTMENT OF STUDENT'S STREAM"; cout<<"\n\n\t[6]
DISPLAY ALL STUDENT'S REGISTERED"; cout<<"\n\n\t[7] CREATE / DISPLAY MERIT LIST";
cout<<"\n\n\t[8] QUIT";
cout<<"\n\t=============================================================\n";
cout<<"\n\n\t\tEnter your choice : "; opt=getche(); switch(opt) { case '1': int p; assign_user();
p=verify_password(); if(p==0) { input_criteria(); } else { cout<<"\n\tU R Not a Valid User.";
cout<<"\n\tU Dont have the Authority to Create Question Bank. Bye\n\n"; } break; case '2': int
option; clrscr(); cout<<"\nWhat do u want --\n\n\n\n\n\tCreate a new student information file or
Append to the existing file?\n\n\t(press 1 for new creation and 2 for appending)"; cin>>option;
if(option==1) { s.new_file(); } else { s.input_data(); } break; case '3': clrscr(); // read_student();
fin.open("student" ,ios::in|ios::out); fsc.open("elig_sc",ios::out); fcom.open("eligcom",ios::out);
farts.open("eligart",ios::out); while(fin.read((char*)& s,sizeof(s)))
{ s.allot_stream(); s.get_stream(); //if(s.get_stream()==0) cout< <"\nApplication Rejected. Not
Eligible\n"; if(s.get_stream()==1) fsc.write((char*)& s,sizeof(s)); if(s.get_stream()==2)
fcom.write((char*)& s,sizeof(s)); if(s.get_stream()==3) farts.write((char*)& s,sizeof(s));
}
fin.close(); fsc.close(); fcom.close(); farts.close(); cout<<"\n\n\n\n\n";
cout<<"\n*******************************************"; cout<<"\n\n\tSTREAM
ALLOCATION DONE."; cout<<"\n*******************************************"; getch();
break; case '4': read_criteria(); // clear(); cout<<"\n Sc : "<<<"\n="" com="" :=""
"<<<"\n****************************************";="" m="" e="" r="" i="" t="" l="" s=""
t";="" cout<<"\n\tenter="" 1="" merit="" list="" science="" 2="" commerce="" 3="" \t";=""
k="getch();" (k="='1')" select_list("elig_sc","sell_sc");="" fin.open("sell_sc",ios::in);=""
select_list("eligcom","sellcom");="" fin.open("sellcom",ios::in);="" select_list("eligart","sellart");=""
fin.open("sellart",ios::in);="" if(k="">='1' && k< ='3') { while(fin.read((char*)& s,sizeof(s))) {
s.display(); cout<<"\n\t Continue (y/n)? : "; c=getche(); c=tolower(c); if(c=='n') break; } }
fin.close(); fin.close(); fin.close(); break; } case '8': thanks(); // cout<<"\nTHANKS BYE "; // exit(0);
break; } } } // END OF WHILE void assign_user() { strcpy(admin.user_name, "abhisek");
strcpy(admin.password, "nokia"); } int verify_password() { char u_name[10]; char
u_pwd[10],temp[2]; int x=1; cout<<"\n\n Enter user name : "; cin>>u_name; cout< <"\n\n Enter
Password : "; cin>>u_pwd; x=strcmp(admin.user_name,u_name); if (x==0) {

x=strcmp(admin.password,u_pwd); } cin.getline(temp,2); return(x); } void student::allot_stream() {


int per=(m_eng+m_math+m_sc+m_sst+m_lang)/5; read_criteria(); switch(pref_code) { case 1:
if(per>=crit.sc_min) stream=pref_code; else stream=0; break; case 2: if(per>=crit.com_min)
stream=pref_code; else stream=0; break; case 3: if(per>=crit.arts_min) stream=pref_code; else
stream=0; break; } } int student::get_stream() { return(stream); } void input_criteria() { fstream
fout; fout.open("criteria" ,ios::in|ios::out); cout< <"\nEnter the required marks for SCIENCE stream
(in percentage) : "; cin>>crit.sc_min; cout< <"\nEnter No. of Seats for SCIENCE stream : ";
cin>>crit.seat_sc; cout< <"\nEnter the required marks for COMMERCE stream(in percentage) : ";
cin>>crit.com_min; cout< <"\nEnter No. of Seats for COMMERCE stream :"; cin>>crit.seat_com;
cout< <"\nEnter the required marks for ARTS stream(in percentage) : "; cin>>crit.arts_min; cout<
<"\nEnter No. of Seats for ARTS stream : "; cin>>crit.seat_arts; fout.write((char*)& crit,sizeof(crit));
fout.close(); } void read_criteria() { fstream fin; fin.open("criteria" ,ios::in); fin.read((char*)&
crit,sizeof(crit)); fin.close(); } void student::input_data() { clrscr(); fstream fin;
fin.open("student",ios::app|ios::out); char t[2], ans; while(1) { cout< <"\nEnter the name of the
student : "; gets(name); cout<<"\n\nEnter the roll of the student : "; cin>>regno; cout< <"\n\nEnter
marks in eng : "; cin>>m_eng; cout< <"\n\nEnter marks in math : "; cin>>m_math; cout< <"\n\nEnter
marks in science : "; cin>>m_sc; cout< <"\n\nEnter marks in sst : "; cin>>m_sst; cout< <"\n\nEnter
marks in language : "; cin>>m_lang; clrscr(); cout< <endl<<endl<<endl<<<"="================"
stream="" prefered="" ?="=============" \n";="" cout<<"\t"<<"[1]="" for="" science\n";=""
cout<<"\t"<<"[2]="" commerce\n";="" cout<<"\t"<<"[3]="" arts="" ";=""
cout<<"\n="================================================" \n\tenter="" preference=""
code="" :="" cin="">>pref_code; stream=-1; fin.write((char*)&s,sizeof(s)); cin.getline(t,2); cout<
<"\n\tEnter More Student ? (y/n) : "; ans=getche(); ans=tolower(ans); if (ans=='n') break; } fin.close();
} void student::new_file() { clrscr(); fstream fin; fin.open("student",ios::out); char t[2], ans; while(1) {
cout<<"\nEnter the name of the student : "; gets(name); cout<<"\n\nEnter the roll of the student : ";
cin>>regno; cout< <"\n\nEnter marks in eng : "; cin>>m_eng; cout< <"\n\nEnter marks in math : ";
cin>>m_math; cout< <"\n\nEnter marks in science : "; cin>>m_sc; cout< <"\n\nEnter marks in sst : ";
cin>>m_sst; cout< <"\n\nEnter marks in language : "; cin>>m_lang; clrscr();
cout< <endl<<endl<<<"="================" stream="" prefered="" ?="=============" \n";=""
cout<<"\t"<<"[1]="" for="" science\n";="" cout<<"\t"<<"[2]="" commerce\n";=""
cout<<"\t"<<"[3]="" arts="" ";=""
cout<<"\n="================================================" \n\tenter="" preference=""
code="" :="" cin="">>pref_code; stream=-1; fin.write((char*)&s,sizeof(s)); cin.getline(t,2); cout<
<"\n\tEnter More Student ? (y/n) : "; ans=getche(); ans=tolower(ans); if (ans=='n') break; } fin.close();
} void student::display() { cout<<"\n============================================\n";
cout<<"\n\tNAME : "<<<"\n\tregistration="" no.="" :="" "<<<"\n\tpercentage="" of="" marks=""
"<<<"%";="" cout<<"\n\tstream="" applied="" for="" "<<<"\n\tpress="" any="" key="" to=""
continue...="" ";="" getch();="" cout<<"\n";="" fin.close();="" read_eligible_sc()="" char="" ans;=""
fout;="" fout.open("elig_sc",ios::in);="" fout.seekg(0);="" while(fout.read((char*)&=""
cout<<"\n\t="" continue="" (y="" n)="" ?="" ans="getche();" if="" (ans="='n')" break;=""
fout.close();="" read_eligible_com()="" fout.open("eligcom",ios::in);="" n)?=""
read_eligible_arts()="" fout.open("eligart",ios::in);="" clear()="" for(int="" i="1;i<=24;i++)" *=""
stream_name(int="" strm)="" switch(strm)="" case="" -1:="" return("not="" assigned");="" 0:=""
return("nill");="" 1:="" return("science");="" 2:="" return("commerce");="" 3:="" return("arts");=""
default:="" return("none");="" select_list(="" *in_file,="" *out_file)="" sel,="" int="" n="0," i,j;=""

student="" sl[100],="" t;="" sel.open(out_file,="" ios::out);="" fin.open(in_file,ios::in);=""


sl[n],sizeof(s)))="" n++;="" cout<<"\nno="" eligible="" students="<<n<<" \n";=""
for(i="0;i<<"\n\n\n\n\n\n\n\n\n\n\t**********="" h="" a="" k="" y="" o="" u="" f="" r="" w=""
g="" *******";="" cout<<"\n\n\n\n\n\n\n\t\t\t="" press="" exit";="" welcome()=""
textmode(c40);="" textbackground(black);="" textcolor(magenta);=""
cout<<endl<<endl<<endl<<<"\n\n="" ***="" welcome="" ***";="" cout<

You might also like