#include<iostream>
#include<fstream>
#include<string.h>
class Result
{
protected:
std::string Student_section;
std::string semester;
std::string roll_num;
std::string subject1;
std::string subject2;
std::string subject3;
std::string subject4;
std::string subject5;
std::string Department;
std::string time1, time_1, time2, time_2, time3, time_3, time4, time_4, time5, time_5;
std::string selection;
public:
void menu()
{
std::cout << "\n\t\t*****************************************************************************\n";
std::cout << "\t\t\t WELCOME TO THE RESULT DOMAIN \n";
std::cout << "\t\t*****************************************************************************\n";
std::cout << "\n 1 CREATE STUDENT RESLULT";
std::cout << "\n 2 UPDATE STUDENT RESULT";
std::cout << "\n 3 SEARCH ALL STUDENT RESULT";
std::cout << "\n 4 SEARCH SPECIFIC STUDENT RESULT";
std::cout << "\n 5 DELETE STUDENT RESULT" << std::endl;
int ch;
std::cin >> ch;
if (ch == 1)
{
Create_student_result();
}
else if (ch == 2)
{
update_student_result();
}
else if (ch == 3)
{
see_all_student_result();
}
else if (ch == 4)
{
check_Result();
}
else if (ch == 5)
{
delete_student_result();
}
else
{
exit(0);
}
}
void Create_student_result()
{
std::cout << "\n\tCREATE THE RESULT OF A STUDENT:\n";
std::ofstream take("result.txt", std::ios::app);
if (take.is_open())
{
std::cout << "\n 1.Please enter the Student Department \n";
std::cin >> Department;
std::cout << "\n 2.Please enter the Student_semester \n";
std::cin >> semester;
std::cout << "\n 3.Please enter the Student_section\n";
std::cin >> Student_section;
std::cout << "\n 4.Please enter the Student roll num\n";
std::cin >> roll_num;
std::cout << "\n .Please enter the 1 subject name of student \n";
std::cin >> subject1;
std::cout << "\n .Please enter the marks for 1 subject \n";
std::cin >> time1;
std::cout << "\n 5.Please enter the 2 subject name of student \n";
std::cin >> subject2;
std::cout << "\n .Please enter the marks for 2 subject \n";
std::cin >> time2;
std::cout << "\n 7.Please enter the 3 subject name of student \n";
std::cin >> subject3;
std::cout << "\n .Please enter the marks for 3 subject \n";
std::cin >> time3;
std::cout << "\n 9.Please enter the 4 subject name of student \n";
std::cin >> subject4;
std::cout << "\n .Please enter the marksfor 4 subject \n";
std::cin >> time4;
std::cout << "\n 11.Please enter the 5 subject name of student \n";
std::cin >> subject5;
std::cout << "\n .Please enter the marks for 5 subject \n";
std::cin >> time5;
take << "\n" << Department << "\t" << semester << "\t" << Student_section << "\t" << roll_num;
take << "\n" << subject1 << "\t" << time1;
take << "\n" << subject2 << "\t" << time2;
take << "\n" << subject3 << "\t" << time3;
take << "\n" << subject4 << "\t" << time4;
take << "\n" << subject5 << "\t" << time5;
}
else
{
std::cout << "error\n";
}
take.close();
int ch;
do {
std::cout << "\n\nIf you want to continue than enter '1' else '0'";
std::cin >> ch;
switch (ch) {
case 1:
system("cls");
return menu();
default:
exit(0);
}
} while (ch);
}
void update_student_result()
{
system("cls");
std::string z;
std::cout << "Enter the code \t:\t";
std::ifstream take;
take.open("result.txt");
std::ofstream temp("temp.txt");
std::cin >> z;
while (!take.eof())
{
take >> Department;
take >> semester;
take >> Student_section;
take >> roll_num;
take >> subject1;
take >> time1;
take >> subject2;
take >> time2;
take >> subject3;
take >> time3;
take >> subject4;
take >> time4;
take >> subject5;
take >> time5;
if (z != roll_num)
{
temp << "\n" << Department << "\t" << semester << "\t" << Student_section << "\t" << roll_num;
temp << "\n" << subject1 << "\t" << time1;
temp << "\n" << subject2 << "\t" << time2;
temp << "\n" << subject3 << "\t" << time3;
temp << "\n" << subject4 << "\t" << time4;
temp << "\n" << subject5 << "\t" << time5;
}
if (z == roll_num)
{
std::cout << "\n 1.Please enter the Student Department \n";
std::cin >> Department;
std::cout << "\n 2.Please enter the Student_semester \n";
std::cin >> semester;
std::cout << "\n 3.Please enter the Student_section\n";
std::cin >> Student_section;
std::cout << "\n 4.Please enter the Student roll num\n";
std::cin >> roll_num;
std::cout << "\n .Please enter the 1 subject name of student \n";
std::cin >> subject1;
std::cout << "\n .Please enter the marks for 1 subject \n";
std::cin >> time1;
std::cout << "\n 5.Please enter the 2 subject name of student \n";
std::cin >> subject2;
std::cout << "\n .Please enter the marks for 2 subject \n";
std::cin >> time2;
std::cout << "\n 7.Please enter the 3 subject name of student \n";
std::cin >> subject3;
std::cout << "\n .Please enter the marks for 3 subject \n";
std::cin >> time3;
std::cout << "\n 9.Please enter the 4 subject name of student \n";
std::cin >> subject4;
std::cout << "\n .Please enter the marksfor 4 subject \n";
std::cin >> time4;
std::cout << "\n 11.Please enter the 5 subject name of student \n";
std::cin >> subject5;
std::cout << "\n .Please enter the marks for 5 subject \n";
std::cin >> time5;
temp << "\n" << Department << "\t" << semester << "\t" << Student_section << "\t" << roll_num;
temp << "\n" << subject1 << "\t" << time1;
temp << "\n" << subject2 << "\t" << time2;
temp << "\n" << subject3 << "\t" << time3;
temp << "\n" << subject4 << "\t" << time4;
temp << "\n" << subject5 << "\t" << time5;
}
}
temp.close();
take.close();
std::remove("result.txt");
std::rename("temp.txt", "result.txt");
int x;
std::cout << "\nIf you want to continous (1/0)";
std::cin >> x;
if (x == 1)
{
system("cls");
menu();
}
}
void see_all_student_result() //all students Result
{
system("cls");
std::cout << "\n\tSEE ALL STUDENT RESULT :\n";
std::ifstream take;
take.open("result.txt");
if (take.is_open())
{
while (!take.eof())
{
take >> Department;
take >> semester;
take >> Student_section;
take >> roll_num;
take >> subject1;
take >> time1;
take >> subject2;
take >> time2;
take >> subject3;
take >> time3;
take >> subject4;
take >> time4;
take >> subject5;
take >> time5;
std::cout << "\n" << Department << "\t" << semester << "\t" << Student_section << "\t" << roll_num;
std::cout << "\n" << subject1 << "\t" << time1;
std::cout << "\n" << subject2 << "\t" << time2;
std::cout << "\n" << subject3 << "\t" << time3;
std::cout << "\n" << subject4 << "\t" << time4;
std::cout << "\n" << subject5 << "\t" << time5;
}
}
take.close();
int ch;
std::cout << "\n\nIf you want to continue than enter '1' else '0'";
std::cin >> ch;
}
void check_Result()
{
system("cls");
std::string k;
std::cout << "Enter the roll_num \t:\t";
std::ifstream take("result.txt");
if (take.is_open())
{
std::cin >> k;
while (!take.eof())
{
take >> Department;
take >> semester;
take >> Student_section;
take >> roll_num;
take >> subject1;
take >> time1;
take >> subject2;
take >> time2;
take >> subject3;
take >> time3;
take >> subject4;
take >> time4;
take >> subject5;
take >> time5;
if (k == roll_num)
{
std::cout << "\n" << Department << "\t" << semester << "\t" << Student_section << "\t" << roll_num;
std::cout << "\n" << subject1 << "\t" << time1;
std::cout << "\n" << subject2 << "\t" << time2;
std::cout << "\n" << subject3 << "\t" << time3;
std::cout << "\n" << subject4 << "\t" << time4;
std::cout << "\n" << subject5 << "\t" << time5;
}
}
}
else
{
std::cout << "file not open";
}
take.close();
int x;
std::cout << "\nIf you want to continous (1/0)";
std::cin >> x;
if (x == 1)
{
system("cls");
}
}
void delete_student_result()
{
system("cls");
std::string z;
std::cout << "Enter the code \t:\t";
std::ifstream take;
take.open("result.txt");
std::ofstream temp("temp.txt");
std::cin >> z;
while (!take.eof())
{
take >> Department;
take >> semester;
take >> Student_section;
take >> roll_num;
take >> subject1;
take >> time1;
take >> subject2;
take >> time2;
take >> subject3;
take >> time3;
take >> subject4;
take >> time4;
take >> subject5;
take >> time5;
if (z != roll_num)
{
temp << "\n" << Department << "\t" << semester << "\t" << Student_section << "\t" << roll_num;
temp << "\n" << subject1 << "\t" << time1;
temp << "\n" << subject2 << "\t" << time2;
temp << "\n" << subject3 << "\t" << time3;
temp << "\n" << subject4 << "\t" << time4;
temp << "\n" << subject5 << "\t" << time5;
}
}
temp.close();
take.close();
std::remove("result.txt");
std::rename("temp.txt", "result.txt");
std::cout << "Delete Succesfully";
int x;
std::cout << "\nIf you want to continous (1/0)";
std::cin >> x;
if (x == 1)
{
system("cls");
menu();
}
}
};
class Student_2:public Result
{
protected:
std::string student_name;
std::string student_fathername;
std::string student_username;
std::string student_section;
int student_semester;
public:
void password()
{
int cont;
std::cout<<"*****************************************************************************\n";
std::cout<<" Welcom To our Program \n";
std::cout<<"*****************************************************************************\n";
std::cout << "\nIf you want continous press(1/0)";
std::cin>>cont;
if(cont==1)
{
student2_menu();
}
else
{
exit(0);
}
}
student2_menu()
{
int a;
system("cls");
std::cout << std::endl;
std::cout << "\t\t1>> Add new Student \n";
std::cout << "\t\t2>> Search the student \n";
std::cout << "\t\t3>> Show the student \n";
std::cout << "\t\t4>> upate the student data \n";
std::cout << "\t\t5>> Delete the student \n";
std::cout<< "\t\t6>> Create Student Course Detail\n";
std::cout<< "\t\t7>> Check Course Detail\n";
std::cout<< "\t\t8>> Delete Course Detail\n";
std::cout << "\t\t0>> Exit\n";
std::cout << "\t Choice the Option\t:\t";
std::cin >> a;
switch (a)
{
case 1:
create_profile();
break;
case 2:
search_profile();
break;
case 3:
show_profile();
break;
case 4:
update_profile();
break;
case 5:
remove_profile();
break;
case 6:
create_course();
break;
case 7:
check_coursedetail();
break;
case 8:
delete_course();
break;
case 0:
exit(0);
break;
default:
student2_menu();
break;
}
}
void create_profile()
{
system("cls");
std::cout << "\n Enter name of Student : ";
std::cin >> student_name;
std::cout << "\n Enter the student Fathername : ";
std::cin >> student_fathername;
std::cout << "\n Enter the Student username : ";
std::cin >> student_username;
std::cout << "\n Enter The student section : ";
std::cin >> student_section;
std::cout << "\n Enter The student Semester : ";
std::cin>>student_semester;
std::cout << "\n Do you wish to save the above details(y/n) : ";
char ch;
std::cin >> ch;
if (ch == 'y')
{
std::ofstream file;
file.open("create.txt", std::ios::app);
if (file.is_open())
{
file << "\n" << student_name << "\t" << student_fathername << "\t" << student_username << "\t" << student_section<<"\t"<<student_semester;
file.close();
}
}
else
{
create_profile();
}
std::cout << "\nIf you want continous press(1/0)";
int m;
std::cin >> m;
if (m == 1)
{
student2_menu();
}
}
void search_profile()
{
system("cls");
std::string c;
std::cout << "Enter the student the Username :";
std::cin >> c;
std::ifstream get;
get.open("create.txt");
if (get.is_open())
{
while (!get.eof())
{
get >> student_name;
get >> student_fathername;
get >> student_username;
get >> student_section;
get >> student_semester;
if (c == student_username)
{
std::cout << student_name << "\t" << student_fathername << "\t" << student_username << "\t" << student_section<<"\t"<<student_semester<< "\n";
}
}
get.close();
}
}
void show_profile()
{
std::ifstream get;
get.open("create.txt");
if (get.is_open())
{
while (!get.eof())
{
get >> student_name;
get >> student_fathername;
get >> student_username;
get >> student_section;
get >> student_semester;
std::cout <<"Student Name:"<< student_name << "\t" <<"Father Name:"<<student_fathername
<< "\t" <<"Student UserName:"<<student_username << "\t" <<"Student Section:"<<
student_section<<"\t"<<"Student Semester:"<<student_semester<< "\n";
}
get.close();
system("pause");
}
}
void update_profile()
{
system("cls");
std::string c;
std::cout << "Enter the student the Username :";
std::cin >> c;
std::ifstream get;
std::ofstream temp;
get.open("create.txt");
temp.open("temprary.txt");
if (get.is_open())
{
while (!get.eof())
{
get >> student_name;
get >> student_fathername;
get >> student_username;
get >> student_section;
get >> student_semester;
if (c != student_username)
{
temp << "\n"<< student_name << "\t" << student_fathername << "\t" << student_username << "\t" << student_section<<"\t"<<student_semester;
}
if(c==student_username)
{
std::cout << "\n Enter name of Student : ";
std::cin >> student_name;
std::cout << "\n Enter the student Fathername : ";
std::cin >> student_fathername;
std::cout << "\n Enter the Student username : ";
std::cin >> student_username;
std::cout << "\n Enter The student section : ";
std::cin >> student_section;
std::cout << "\n Enter The student Semester : ";
std::cin>>student_semester;
temp << student_name << "\t" << student_fathername << "\t" << student_username << "\t" << student_section<<"\t"<<student_semester;
}
}
get.close();
temp.close();
std::remove("create.txt");
std::rename("temprary.txt", "create.txt");
}
}
void remove_profile()
{
system("cls");
std::string c;
std::cout << "Enter the student the Username :";
std::cin >> c;
std::ifstream get;
std::ofstream temp;
get.open("create.txt");
temp.open("temprary.txt");
if (get.is_open())
{
while (!get.eof())
{
get >> student_name;
get >> student_fathername;
get >> student_username;
get >> student_section;
get >> student_semester;
if (c != student_username)
{
temp << "\n"<< student_name << "\t" << student_fathername << "\t" << student_username << "\t" << student_section<<"\t"<<student_semester;
}
else
{
std::cout<<"Delete Data Successfully\n";
}
}
get.close();
temp.close();
std::remove("create.txt");
std::rename("temprary.txt", "create.txt");
}
std::cout << "\nIf you want continous press(1/0)";
int m;
std::cin >> m;
if (m == 1)
{
student2_menu();
}
}
void create_course()
{
system("cls");
std::string Teacher_name;
std::string semester;
std::string subject1;
std::string subject2;
std::string subject3;
std::string subject4;
std::string subject5;
std::string Department;
int time1, time2, time3, time4, time5;
std::cout << "\nPlease Set the Time_table:\n";
std::ofstream time_t("timetable.txt", std::ios::app);
if (time_t.is_open())
{
std::cout << "\n\n 1.Please enter the Teacher_name\n";
std::cin >> Teacher_name;
std::cout << "\n 2.Please enter the Student_Semester \n";
std::cin >> semester;
std::cout << "\n 3.Please enter the 1 subject name of Student \n";
std::cin >> subject1;
std::cout << "\n 4.Please enter the time for 1 subject \n";
std::cin >> time1;
std::cout << "\n 5.Please enter the 2 subject name of student \n";
std::cin >> subject2;
std::cout << "\n 6.Please enter the time for 2 subject \n";
std::cin >> time2;
std::cout << "\n 7.Please enter the 3 subject name of student \n";
std::cin >> subject3;
std::cout << "\n 8.Please enter the time for 3 subject \n";
std::cin >> time3;
std::cout << "\n 9.Please enter the 4 subject name of student \n";
std::cin >> subject4;
std::cout << "\n 10.Please enter the time for 4 subject \n";
std::cin >> time4;
std::cout << "\n 11.Please enter the 5 subject name of student \n";
std::cin >> subject5;
std::cout << "\n 12.Please enter the time for 5 subject \n";
std::cin >> time5;
std::cout << "\n 13.Please enter the Student Department \n";
std::cin >> Department;
time_t << Teacher_name << "\t" << semester<<"\t"<< Department << "\n";
time_t << subject1 << "\t" << time1 << "\t" << subject2 << "\t" << time2 << "\t"
<< subject3 << "\t" << time3 << "\n";
time_t << subject4 << "\t" << time4 << "\t" << subject5 << "\t" << time5 << "\n";
}
else
{
std::cout << "error\n";
}
time_t.close();
std::cout << "\nIf you want continous press(1/0)";
int m;
std::cin >> m;
if (m == 1)
{
student2_menu();
}
}
void check_coursedetail()
{
system("cls");
std::string Teacher_name;
std::string semester;
std::string subject1;
std::string subject2;
std::string subject3;
std::string subject4;
std::string subject5;
std::string Department;
int time1, time2, time3, time4, time5;
std::ifstream take("timetable.txt");
if (take.is_open())
{
take >> Teacher_name;
take >> semester;
take >> Department;
take >> subject1;
take >> time1;
take >> subject2;
take >> time2;
take >> subject3;
take >> time3;
take >> subject4;
take >> time4;
take >> subject5;
take >> time5;
while (!take.eof())
{
std::cout <<"\nSubject NO 1:"<< subject1 << "\t" <<"Time:"<<time1 << "\t" <<"Subject NO 2:"<< subject2 << "\t"
<<"Time:"<< time2<< "\n"
<<"Subject NO 3:"<< subject3 << "\t" << "Time:"<<time3 << "\t" <<"Subject NO 4:"<< subject4
<< "\t" <<"Time:"<< time4 << "\n"
<<"Subject NO 5:"<<subject5 << "\t" << "Time:"<<time5 << "\n\n";
std::cout << "01.Teacher Name:"<<Teacher_name << "\t\t" <<"02.Semester:"<<semester << "\t\t"
<<"03.Department:"<<Department << "\n";
take >> Teacher_name;
take >> semester;
take >> Department;
take >> subject1;
take >> time1;
take >> subject2;
take >> time2;
take >> subject3;
take >> time3;
take >> subject4;
take >> time4;
take >> subject5;
take >> time5;;
break;
}}
take.close();
system("pause");
}
void delete_course()
{
system("cls");
std::string deleteline;
std::string Data_line;
std::ifstream del("timetable.txt");
if (!del.is_open())
{
std::cout << "Input file failed to open\n";
}
std::ofstream temp("temp_file.txt");
std::cout << "Please Select the your line for delete record:\n";
std::cin >> deleteline;
while (getline(del, deleteline))
{
if (Data_line != deleteline)
temp << Data_line << "\n";
}
del.close();
temp.close();
remove("timetable.txt");
rename("temp_file.txt", "timetable.txt");
}
};
class Student_attendence:public Student_2
{
protected:
std::string student_name;
std::string student_username;
std::string teacher_name;
std::string subject;
std::string date;
std::string mark;
int time;
public:
student_attendence()
{
student_name="N/A";
student_username="N/A";
teacher_name="N/A";
subject="N/A";
date="N/A";
mark="N/A";
time=0;
}
void display()
{ system("cls");
std::cout<<"\n\t\t**********************************************";
std::cout<<"\n\t\t\t WELCOME TO STUDENT ATTENDENCE";
std::cout<<"\n\t\t**********************************************";
int y;
std::cout<<"\n\n\t\t If You Go To Attendence Menu Press 1 Otherwise press 0::";
std::cin>>y;
if(y==1)
{
attendence_menu();
}
if(y==0)
{
exit(0);
}
}
void attendence_menu()
{
system("cls");
std::cout<<"\n\n\t\t Menu:";
std::cout<<"\n\t\t 01.Create Student Attendence Record";
std::cout<<"\n\t\t 02.Check Student Attendence Record";
std::cout<<"\n\t\t 03.Search Student Attendence Record";
std::cout<<"\n\t\t 04.Update Student Attendence Record";
std::cout<<"\n\t\t 05.Removed Student Attendence Record";
std::cout<<"\n\t\t 00.Exit ";
std::cout<<"\n\n\t\t 01.Enter the Selection:";
int num;
std::cin>>num;
switch(num)
{
case 1:
create_attendence();
break;
case 2:
check_attendence();
break;
case 3:
search_attendence();
break;
case 4:
update_attendence();
break;
case 5:
Removed_attendence();
break;
default:
{
std::cout<<"\n\t\tEnter the Valid Selection!\n";
break;
}
}
}
void create_attendence()
{
std::string search;
std::cout<<"\n\t\tEnter the Student Username:";
std::cin>>search;
std::ofstream emo("attendence.txt", std::ios::app);
std::ifstream read("create.txt");
while(!read.eof())
{
read>>student_name;
read>>student_fathername;
read>>student_username;
read>>student_section;
read>>student_semester;
if(search==student_username)
{
std::cout<<"\n\t\t01.Enter Date:";
std::cin>>date;
std::cout<<"\n\t\t01.Enter Time:";
std::cin>>time;
std::cout<<"\n\t\t01.Enter Subject:";
std::cin>>subject;
std::cout<<"\n\t\t01.Enter Mark Attendence (P/A):";
std::cin>>mark;
std::cout<<"\n\t\t01.Enter Teacher Name:";
std::cin>>teacher_name;
emo<<"\n";
emo <<student_name<<"\t" ;
emo <<student_fathername<<"\t" ;
emo <<student_username<<"\t" ;
emo <<student_section<<"\t" ;
emo <<student_semester<<"\t" ;
emo <<date<<"\t" ;
emo <<time<<"\t" ;
emo <<subject<<"\t" ;
emo <<mark<<"\t" ;
emo <<teacher_name<<"\n" ;
}
}
emo.close();
read.close();
int ch;
do
{
std::cout << "\n\nDo you want Back in Menu Press'1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return attendence_menu();
default:
exit(0);
}
} while (ch);
}
void check_attendence()
{
std::ifstream take("attendence.txt");
take>>student_name;
take>>student_fathername;
take>>student_username;
take>>student_section;
take>>student_semester;
take>>date;
take>>time;
take>>subject;
take>>mark;
take>>teacher_name;
while (!take.eof())
{
std::cout<<"\n\n01.Student Name:"<<student_name<<"\t"<<"02.Father Name:"<<student_fathername<<"\t"
<<"03.Stdudent username:"<<student_username<<"\n";
std::cout<<"04.Student section:"<<student_section<<"\t"<<"05.Student semester:"<<student_semester<<"\t"
<<"06.Date:"<<date<<"\n";
std::cout<<"07.Time:"<<time<<"PM"<<"\t\t"<<"08.Subject:"<<subject<<"\t"
<<"09.Attendence Mark:"<<mark<<"\n";
std::cout<<"\n Teacher Name:"<<teacher_name<<"\n";
take>>student_name;
take>>student_fathername;
take>>student_username;
take>>student_section;
take>>student_semester;
take>>date;
take>>time;
take>>subject;
take>>mark;
take>>teacher_name;
}
take.close();
int ch;
do
{
std::cout << "\n\nDo you want Back in Menu Press'1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return attendence_menu();
default:
exit(0);
}
} while (ch);
}
void search_attendence()
{
std::string search;
std::cout << "Enter the Student username for search : ";
std::cin >> search;
std::ifstream take("attendence.txt");
take>>student_name;
take>>student_fathername;
take>>student_username;
take>>student_section;
take>>student_semester;
take>>date;
take>>time;
take>>subject;
take>>mark;
take>>teacher_name;
while (!take.eof())
{
if (search ==student_username)
{
std::cout<<"\n\n01.Student Name:"<<student_name<<"\t"<<"02.Father Name:"<<student_fathername<<"\t"
<<"03.Stdudent username:"<<student_username<<"\n";
std::cout<<"04.Student section:"<<student_section<<"\t"<<"05.Student semester:"<<student_semester<<"\t"
<<"06.Date:"<<date<<"\n";
std::cout<<"07.Time:"<<time<<"PM"<<"\t\t"<<"08.Subject:"<<subject<<"\t\t"
<<"09.Attendence Mark:"<<mark<<"\n";
std::cout<<"\n Teacher Name:"<<teacher_name<<"\n";
}
take>>student_name;
take>>student_fathername;
take>>student_username;
take>>student_section;
take>>student_semester;
take>>date;
take>>time;
take>>subject;
take>>mark;
take>>teacher_name;
}
take.close();
}
void update_attendence()
{
std::string search;
std::cout<<"Enter the username of Student :"<<"\n";
std::cin>>search;
std::ifstream d;
d.open("attendence.txt");
std::ofstream f;
f.open("temp.txt");
d>>student_name;
d>>student_fathername;
d>>student_username;
d>>student_section;
d>>student_semester;
d>>date;
d>>time;
d>>subject;
d>>mark;
d>>teacher_name;
while(!d.eof())
{
if(search!=student_username)
{
f<<"\n";
f<<student_name<<"\t" ;
f<<student_fathername<<"\t" ;
f<<student_username<<"\t" ;
f<<student_section<<"\t" ;
f<<student_semester<<"\t" ;
f<<date<<"\t" ;
f<<time<<"\t" ;
f<<subject<<"\t" ;
f<<mark<<"\t" ;
f<<teacher_name<<"\n" ;
}
else
{
std::cout<<"Enter the Time:";
std::cin>>time;
std::cout<<"Enter the date:";
std::cin>>date;
std::cout<<"Enter Subject:";
std::cin>>subject;
std::cout<<"Enter update in Attendence Mark:";
std::cin>>mark;
f<<"\n";
f<<student_name<<"\t" ;
f<<student_fathername<<"\t" ;
f<<student_username<<"\t" ;
f<<student_section<<"\t" ;
f<<student_semester<<"\t" ;
f<<date<<"\t" ;
f<<time<<"\t" ;
f<<subject<<"\t" ;
f<<mark<<"\t" ;
f<<teacher_name<<"\n" ;
}
d>>student_name;
d>>student_fathername;
d>>student_username;
d>>student_section;
d>>student_semester;
d>>date;
d>>time;
d>>subject;
d>>mark;
d>>teacher_name;
}
d.close();
f.close();
std::remove ("attendence.txt");
std::rename("temp.txt","attendence.txt");
int ch;
do
{
std::cout << "\n\nDo you want Back in Menu Press'1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return attendence_menu();
default:
exit(0);
}
} while (ch);
}
void Removed_attendence()
{
std::string search;
std::cout<<"Enter the Username of Student for deleted:"<<"\n";
std::cin>>search;
std::ifstream d;
d.open("attendence.txt");
std::ofstream f;
f.open("temp.txt");
d>>student_name;
d>>student_fathername;
d>>student_username;
d>>student_section;
d>>student_semester;
d>>date;
d>>time;
d>>subject;
d>>mark;
d>>teacher_name;
while(!d.eof())
{
if(search!=student_username)
{
f<<"\n";
f<<student_name<<"\t" ;
f<<student_fathername<<"\t" ;
f<<student_username<<"\t" ;
f<<student_section<<"\t" ;
f<<student_semester<<"\t" ;
f<<date<<"\t" ;
f<<time<<"\t" ;
f<<subject<<"\t" ;
f<<mark<<"\t" ;
f<<teacher_name<<"\n" ;
}
else
{
std::cout<<"your data has successfully deleted!\n";
}
d>>student_name;
d>>student_fathername;
d>>student_username;
d>>student_section;
d>>student_semester;
d>>date;
d>>time;
d>>subject;
d>>mark;
d>>teacher_name;
}
d.close();
f.close();
std::remove ("attendence.txt");
std::rename("temp.txt","attendence.txt");
int ch;
do
{
std::cout << "\n\nDo you want Back in Menu Press'1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return attendence_menu();
default:
exit(0);
}
} while (ch);
}
};
class library:public Student_attendence
{
protected:
std::string Chief_name;
std::string Cheif_CNIC;
std::string Chief_Username;
std::string Book_name;
std::string Book_Author;
std::string Member_name;
int Chief_password;
int Book_id;
int Member_id;
int fine;
public:
library ()
{
Chief_name = "N/A";
Cheif_CNIC = "N/A";
Chief_Username = "N/A";
Book_name = "N/A";
Book_Author = "N/A";
Member_name = "N/A";
Chief_password = 0;
Book_id=0;
Member_id=0;
fine=0;
}
void Chief_Password ()
{
int cont;
std::cout<<"\n\t\t**********************************************";
std::cout<<"\n\t\t\t WELCOME TO LIBRARY";
std::cout<<"\n\t\t**********************************************";
std::cout << "\nIf you want continous press(1/0)";
std::cin>>cont;
if(cont==1)
{
Chief_menu();
}
else
{
exit(0);
}
}
void Chief_menu ()
{
system("cls");
int num2;
std::cout << "\n\n\n\t\tMENU:\n";
std::cout << "\n\t01.CREATE STUDENT RECORD ";
std::cout << "\n\t02.DISPLAY ALL STUDENTS RECORD";
std::cout << "\n\t03.DISPLAY SPECIFIC STUDENT RECORD ";
std::cout << "\n\t04.DELETE STUDENT RECORD ";
std::cout << "\n\t05.CREATE BOOK Record:";
std::cout << "\n\t06.DISPLAY ALL BOOK";
std::cout << "\n\t07.DISPLAY SPECIFIC BOOK";
std::cout << "\n\t08.DELETE BOOK RECORD";
std::cout << "\n\t09.Create_CHIEF_PROFILE";
std::cout << "\n\t10.UPDATE_CHIEF_PROFILE";
std::cout << "\n\t11.Check_CHIEF_PROFILE";
std::cout << "\n\t12.Delete_CHIEF_PROFILE";
std::cout << "\n\t13.Create Fine";
std::cout << "\n\t14.Check Fine";
std::cout << "\n\t14.Update Fine";
std::cout << "\n\t00. Exit ..";
std::cout << "\n\n\t...Enter the Selection";
std::cin >> num2;
switch (num2)
{
case 1:
student_record();
break;
case 2:
allmember();
break;
case 3:
search();
break;
case 4:
removemember();
break;
case 5:
newbooks();
break;
case 6:
searchb();
break;
case 7:
allbook();
break;
case 8:
removebook();
break;
case 9:
create_cheif();
break;
case 10:
update_cheif();
break;
case 11:
view_chief();
break;
case 12:
delete_cheif();
break;
case 13:
create_fine();
break;
case 14:
check_fine();
break;
case 15:
update_fine();
break;
case 0:
exit(0);
break;
default:
{
std::cout << "Invalid choice, Please try again";
}
}}
//1create student record::
void student_record()
{
std::ofstream write("stud.txt", std::ios::app);
if (write.is_open())
{ std::cout << "\n\n\t Enter the information \n ";
std::cout<<"Enter the name of student:"<<"\n";
std::cin>>Member_name;
std::cout<<"Enter the ID of student:"<<"\n";
std::cin>>Member_id;
write<<"\n";
write <<Member_name<<"\t" ;
write <<Member_id<<"\n" ;
}
else
{
std::cout << "error" << " \t\t";
}
write.close();
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
return library::Chief_menu();
default:
exit(0);
}
} while (ch);
}
//2display student record
void allmember()
{
std::ifstream take("stud.txt");
take >>Member_name;
take >>Member_id;
while (!take.eof())
{
std::cout <<Member_name << "\t\t" <<Member_id<< std::endl;
take >>Member_name;
take >>Member_id;
}
take.close();
int ch;
do
{
std::cout << "\n\nIf you want to continue than enter '1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return library::Chief_menu();
default:
exit(0);
}
} while (ch);
}
//3display record for special student
void search()
{
system("cls");
int search;
std::cout << "Enter the Student ID for search : ";
std::cin >> search;
std::ifstream take("stud.txt");
take >>Member_name ;
take >>Member_id;
while (!take.eof())
{
if (search ==Member_id)
{
std::cout << Member_name<< "\t" <<Member_id<<std::endl;
}
take >>Member_name ;
take >>Member_id;
}
take.close();
int ch;
do
{ std::cout << "\n\nIf you want to continue than enter '1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
exit(0);
default:
exit(0);
}
} while (ch);
}
//4 remove member
void removemember()
{
int search;
std::cout<<"Enter the ID of Student for Deleted:"<<"\n";
std::cin>>search;
std::ifstream d;
d.open("stud.txt");
std::ofstream f;
f.open("temp.txt");
d>>Member_name;
d>>Member_id;
while(!d.eof())
{
if(search!=Member_id)
{
f<<"\n";
f<<Member_name<<"\t" ;
f<<Member_id<<"\n" ;
}
else
{
std::cout<<" Data was successfully deleted!\n";
}
d>>Member_name;
d>>Member_id;
}
d.close();
f.close();
std::remove ("stud.txt");
std::rename("temp.txt","stud.txt");
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
return library::Chief_menu();
default:
exit(0);
}
} while (ch);
}
//5create books
void newbooks()
{
std::cout << "\n\n\tPlease enter the Book Record \n";
std::ofstream write("book.txt", std::ios::app);
if (write.is_open())
{
std::cout << "\n 1.Enter the Book Name: \n";
std::cin>>Book_name;
std::cout << "\n 1.Enter the Book Author Name: \n";
std::cin>>Book_Author;
std::cout << "\n 1.Enter the Book ID: \n";
std::cin>>Book_id;
write<<"\n";
write<<Book_name<<"\t";
write<<Book_Author<<"\t";
write<<Book_id<<"\n";
}
else
{
std::cout << "error" << std::endl;
}
write.close();
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
exit(0);
default:
exit(0);
}
} while (ch);
}
//6search specific books
void searchb()
{
int search;
std::cout << "Enter the ID of Book for search:";
std::cin >> search;
std::ifstream take("book.txt");
if (take.is_open())
{
take>>Book_name;
take>>Book_Author;
take >>Book_id;
while (!take.eof())
{
if (search == Book_id)
{
std::cout <<Book_name<<"\t"<<Book_Author<<"\t"<<Book_id<< std::endl;
break;
}
take>>Book_name;
take>>Book_Author;
take >>Book_id;
}
take.close();
}
else
{
std::cout << "File error\n";
}
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
exit(0);
default:
exit(0);
}
} while (ch);
}
//7 display book's;
void allbook()
{
std::ifstream take("book.txt");
take>>Book_name;
take>>Book_Author;
take >>Book_id;
while (!take.eof())
{
std::cout <<Book_name<<"\t"<<Book_Author<<"\t"<<Book_id<< std::endl;
take>>Book_name;
take>>Book_Author;
take >>Book_id;
}
take.close();
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
exit(0);
default:
exit(0);
}
} while (ch);
}
//8 delete book record..
void removebook()
{
int search;
std::cout<<"Enter the ID of Book for Deleted:"<<"\n";
std::cin>>search;
std::ifstream d;
d.open("book.txt");
std::ofstream f;
f.open("temp.txt");
d>>Book_name;
d>>Book_Author;
d>>Book_id;
while(!d.eof())
{
if(search!=Book_id)
{
f<<"\n";
f<<Book_name<<"\t";
f<<Book_Author<<"\t";
f<<Book_id<<"\n";
}
else
{
std::cout<<" Data was successfully deleted!\n";
}
d>>Book_name;
d>>Book_Author;
d>>Book_id;
}
d.close();
f.close();
std::remove ("book.txt");
std::rename("temp.txt","book.txt");
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
return library::Chief_menu();
default:
exit(0);
}
} while (ch);
}
//9 create chief record:
void create_cheif()
{
std::ofstream emo("chief.txt", std::ios::app);
if (emo.is_open())
{ std::cout << "\n\n\t Enter the Chief Information as a library instructor\n ";
std::cout<<"Enter the Name of Chief:"<<"\n";
std::cin>>Chief_name;
std::cout<<"Enter the Username of Chief:"<<"\n";
std::cin>>Chief_Username;
std::cout<<"Enter the CNIC number of Chief:"<<"\n";
std::cin>>Cheif_CNIC;
emo<<"\n";
emo <<Chief_name<<"\n" ;
emo <<Chief_Username<<"\n" ;
emo <<Cheif_CNIC<<"\n" ;
}
else
{
std::cout << "error" << " \t\t";
}
emo.close();
int ch;
do
{
std::cout << "\n\nIf you want to continue than enter '1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return library::Chief_menu();
default:
exit(0);
}
} while (ch);
}
//11delete chief record..
void delete_cheif()
{
std::string search;
std::cout<<"Enter the username of chief for deleted:"<<"\n";
std::cin>>search;
std::ifstream d;
d.open("chief.txt");
std::ofstream f;
f.open("temp.txt");
d>>Chief_name;
d>>Chief_Username ;
d>>Cheif_CNIC ;
while(!d.eof())
{
if(search!=Chief_Username)
{
f<<"\n";
f<<Chief_name<<"\n" ;
f<<Chief_Username<<"\n" ;
f<<Cheif_CNIC<<"\n" ;
}
else
{
std::cout<<"your data has successfully deleted!\n";
}
d>>Chief_name;
d>>Chief_Username ;
d>>Cheif_CNIC ;
}
d.close();
f.close();
std::remove ("chief.txt");
std::rename("temp.txt","chief.txt");
int ch;
do
{
std::cout << "\n\nIf you want to continue than enter '1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return library::Chief_menu();
default:
exit(0);
}
} while (ch);
}
//view chief
void view_chief()
{
std::ifstream take("chief.txt");
take>>Chief_name;
take>>Chief_Username ;
take>>Cheif_CNIC ;
while (!take.eof())
{
std::cout<<"01chief name:"<<Chief_name<<"\t"<<"02chief username:"<<" "
<<Chief_Username<<"\t"<<"03Chief cnic:"<<" "<<Cheif_CNIC<<"\n";
take>>Chief_name;
take>>Chief_Username ;
take>>Cheif_CNIC ;
}
take.close();
int ch;
do
{
std::cout << "\n\nIf you want to continue than enter '1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return library::Chief_menu();
default:
exit(0);
}
} while (ch);
}
//10update chief
void update_cheif()
{
std::string search;
std::cout<<"Enter the username of chief for deleted:"<<"\n";
std::cin>>search;
std::ifstream d;
d.open("chief.txt");
std::ofstream f;
f.open("temp.txt");
d>>Chief_name;
d>>Chief_Username ;
d>>Cheif_CNIC ;
while(!d.eof())
{
if(search!=Chief_Username)
{
f<<"\n";
f<<Chief_name<<"\n" ;
f<<Chief_Username<<"\n" ;
f<<Cheif_CNIC<<"\n" ;
}
else
{
std::cout<<"Enter the chief Name:";
std::cin>>Chief_name;
std::cout<<"Enter the usename of chief:";
std::cin>>Chief_Username;
std::cout<<"Enter the cnic of chief:";
std::cin>>Cheif_CNIC;
f<<"\n";
f<<Chief_name<<"\n" ;
f<<Chief_Username<<"\n" ;
f<<Cheif_CNIC<<"\n" ;
}
d>>Chief_name;
d>>Chief_Username ;
d>>Cheif_CNIC ;
}
d.close();
f.close();
std::remove ("chief.txt");
std::rename("temp.txt","chief.txt");
int ch;
do
{
std::cout << "\n\nIf you want to continue than enter '1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return library::Chief_menu();
default:
exit(0);
}
} while (ch);
}
//create fine ...
void create_fine()
{
int search;
int day;
std::cout<<"Enter the ID of student:";
std::cin>>search;
std::ifstream take("stud.txt");
std::ofstream get("fine.txt",std::ios::app);
take >>Member_name ;
take >>Member_id;
while (!take.eof())
{
if (search ==Member_id)
{
std::cout << Member_name<< "\t" <<Member_id<<std::endl;
std::cout<<"Enter the Days";
std::cin>>day;
if(day<=30)
{
std::cout<<"You return book in Time So, no Fine";
}
else if(day>30)
{
day=day-30;
fine=day*100;
std::cout<<"You Pay The Fine RS."<<fine<<"\n";
get<<Member_name<<"\t";
get<<Member_id<<"\t";
get<<fine<<std::endl;
get.close();
}
}
take >>Member_name ;
take >>Member_id;
}
take.close();
int ch;
do
{
std::cout << "\n\nIf you want to continue than enter '1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
exit(0);
default:
exit(0);
}
} while (ch);
}
//check fine....
void check_fine()
{
int n;
int search;
std::cout<<"Enter the ID of student:";
std::cin>>search;
std::ifstream get("fine.txt");
get >>Member_name;
get >>Member_id;
get >>fine;
while (!get.eof())
{
if (search ==Member_id)
{
std::cout << "\t"<<Member_name<< "\t" <<Member_id<<"\t"<<fine<<std::endl;
n=1;
}
get >>Member_name ;
get >>Member_id;
get >>fine;
}
get.close();
if(n!=1)
{
std::cout<<"You Have not Take any book\n";
}
}
void update_fine()
{
int search;
std::cout<<"Enter the username "<<"\n";
std::cin>>search;
std::ifstream d;
d.open("fine.txt");
std::ofstream f;
f.open("temp.txt");
d >>Member_name;
d >>Member_id;
d >>fine;
while(!d.eof())
{
if(search!=Member_id)
{
f<<Member_name<<"\t" ;
f<<Member_id<<"\t" ;
f<<fine<<"\n" ;
}
else
{
std::cout<<"Enter the Student Name:";
std::cin>>Member_name;
std::cout<<"Enter the ID of Student:";
std::cin>>Member_id;
std::cout<<"Enter the Fine:";
std::cin>>fine;
f<<Member_name<<"\t" ;
f<<Member_id<<"\t" ;
f<<fine<<"\n" ;
}
d >>Member_name;
d >>Member_id;
d >>fine;
}
d.close();
f.close();
std::remove ("fine.txt");
std::rename("temp.txt","fine.txt");
}
};
class fine:public library
{
protected:
std::string Member_id;
public:
void display()
{ std::cout<<"\n\t\t**************************************";
std::cout<<" \n\t\t\tWelcome to Fine side:";
std::cout<<"\n\t\t**************************************";
int y;
std::cout<<"\n\n\t\tAre you soure You Enter this class:(1/0):";
std::cin>>y;
if(y==1)
{
fine_menu();
}
if(y==0)
{
exit(0);
}
}
void fine_menu()
{
std::cout<<"\n\t\tMenu:\n";
std::cout<<"\n\t\t01.Search Fine";
std::cout<<"\n\t\t02.Update Fine";
std::cout<<"\n\t\t03.Exit";
int num;
std::cout<<"\n\t\tEnter your Selection:";
std::cin>>num;
switch(num)
{
case 1:
check_fine();
break;
case 2:
update_fine();
break;
case 3:
exit(0);
default:
{
std::cout<<"\n\t\tEnter valid selection!";
}
}
}
};
//2nd class
class Accountant:public fine
{
protected:
std::string student_name;
std::string student_semester;
std::string student_username;
std::string name;
std::string student_section;
int password;
int challan_no;
int amount;
public:
Accountant()
{
student_name ="Null";
student_semester="Null";
student_username="Null";
student_section="Null";
name="accountant";
password=123;
challan_no=0;
amount=0;
}
void accountan_password()
{
int cont;
std::cout<<"\n\t\t\t*********************************************************\n";
std::cout<<"\n\t\t\t\t\t ... Wellcome to Accountant...\n";
std::cout<<"\n\t\t\t*********************************************************\n\n";
std::cout << "\nIf you want continous press(1/0)";
std::cin>>cont;
if(cont==1)
{
accountant_menu();
}
else
{
exit(0);
}
}
void accountant_menu()
{ system("cls");
std::cout<<"\n\tWellcome to Accountant Menu:\n\n";
std::cout<<"\t01.Create the Student fee:\n";
std::cout<<"\t02.Check All the Student fee:\n";
std::cout<<"\t03.Check the Student fine:\n";
std::cout<<"\t04.Check specific Student fee:\n";
std::cout<<"\t05.Update the Student fee:\n";
std::cout<<"\t06.Delete the Student fee:\n";
std::cout<<"\t07.Submit the Student fee:\n";
std::cout<<"\t08.Submit the Student fine:\n";
std::cout<<"\t0.Exit (0):\n\n";
std::cout<<"\tEnter the Selection:"<<" ";
int num;
std::cin>>num;
switch(num)
{
case 1:
create_fee();
break;
case 2:
check_allfee();
break;
case 3:
check_fine();
break;
case 4:
check_specificfee();
break;
case 5:
update_fee();
break;
case 6:
delete_fee();
break;
case 7:
submit_fee();
break;
case 8:
submit_fine();
break;
case 0:
exit(0);
default:
{
std::cout<<"\tPlease Enter valid choice!\n";
}
}
}
//1create student fee......
void create_fee()
{
std::ofstream write("fee.txt", std::ios::app);
if (write.is_open())
{ std::cout << "\n\n\t Enter the information for student fee\n ";
std::cout<<"Enter the Name of student:"<<"\n";
std::cin>>student_name;
std::cout<<"Enter the Username of student:"<<"\n";
std::cin>>student_username;
std::cout<<"Enter the semester of student :"<<"\n";
std::cin>>student_semester;
std::cout<<"Enter the section of student :"<<"\n";
std::cin>>student_section;
std::cout<<"Enter the Challan no:"<<"\n";
std::cin>>challan_no;
std::cout<<"Enter the Total amount :"<<"\n";
std::cin>>amount;
write<<"\n";
write <<student_name<<"\t" ;
write <<student_username<<"\t" ;
write <<student_semester<<"\t" ;
write <<student_section<<"\t" ;
write <<challan_no<<"\t" ;
write <<amount<<"\n" ;
}
else
{
std::cout << "error" << " \t\t";
}
write.close();
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
return Accountant::accountant_menu();
default:
exit(0);
}
} while (ch);
}
//2check fee record all student..
void check_allfee()
{
std::ifstream take("fee.txt");
take >>student_name;
take>>student_username ;
take>>student_semester;
take>>student_section;
take>>challan_no;
take>>amount;
while (!take.eof())
{
std::cout<<"01 Student_name:"<<student_name<<"\t"<<"02 Student_username:"
<<student_username<<"\t"<<"03 Challan_No:"<<challan_no<<"\n";
std::cout<<"04 Student_Section:"<<student_section<<"\t"<<"05 Student_Semester:"
<<student_semester<<"\t"<<"\t"<<"06 Total Amount:"<<amount<<"\n\n";
take >>student_name;
take>>student_username ;
take>>student_semester;
take>>student_section;
take>>challan_no;
take>>amount;
}
take.close();
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
return Accountant::accountant_menu();
default:
exit(0);
}
} while (ch);
}
//4check specific student fee record
void check_specificfee()
{
std::string search;
std::cout << "Enter the Username of Student for search:";
std::cin >> search;
std::ifstream take("fee.txt");
if (take.is_open())
{
take >>student_name;
take>>student_username ;
take>>student_semester;
take>>student_section;
take>>challan_no;
take>>amount;
while (!take.eof())
{
if (search == student_username)
{
std::cout<<"01 Student_name:"<<student_name<<"\t"<<"02 Student_username:"
<<student_username<<"\t"<<"03 Challan_No:"<<challan_no<<"\n";
std::cout<<"04 Student_Section:"<<student_section<<"\t"<<"05 Student_Semester:"
<<student_semester<<"\t"<<"\t"<<"06 Total Amount:"<<amount<<"\n";
break;
}
take >>student_name;
take>>student_username ;
take>>student_semester;
take>>student_section;
take>>challan_no;
take>>amount;
}
take.close();
}
else
{
std::cout << "File error\n";
}
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
return Accountant::accountant_menu();
default:
exit(0);
}
} while (ch);
}
//5update student fee record..
void update_fee()
{
std::string search;
std::cout<<"Enter the username of Student for update:"<<"\n";
std::cin>>search;
std::ifstream d;
d.open("fee.txt");
std::ofstream f;
f.open("temp.txt");
d >>student_name;
d>>student_username ;
d>>student_semester;
d>>student_section;
d>>challan_no;
d>>amount;
while(!d.eof())
{
if(search!=student_username)
{
f<<"\n";
f<<student_name<<"\t" ;
f<<student_username<<"\t" ;
f<<student_semester<<"\t" ;
f<<student_section<<"\t" ;
f<<challan_no<<"\t" ;
f<<amount<<"\n" ;
}
else
{
std::cout<<"Enter the Student Name:";
std::cin>>student_name;
std::cout<<"Enter the Section of student:";
std::cin>>student_section;
std::cout<<"Enter the Semester of Student:";
std::cin>>student_semester;
f<<"\n";
f<<student_name<<"\t" ;
f<<student_username<<"\t" ;
f<<student_semester<<"\t" ;
f<<student_section<<"\t" ;
f<<challan_no<<"\t" ;
f<<amount<<"\n" ;
}
d >>student_name;
d>>student_username ;
d>>student_semester;
d>>student_section;
d>>challan_no;
d>>amount;
}
d.close();
f.close();
std::remove ("fee.txt");
std::rename("temp.txt","fee.txt");
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
return Accountant::accountant_menu();
default:
exit(0);
}
} while (ch);
}
//6 delete student fee record
void delete_fee()
{
std::string search;
std::cout<<"Enter the username of Student for Deleted:"<<"\n";
std::cin>>search;
std::ifstream d;
d.open("fee.txt");
std::ofstream f;
f.open("temp.txt");
d>>student_name;
d>>student_username ;
d>>student_semester;
d>>student_section;
d>>challan_no;
d>>amount;
while(!d.eof())
{
if(search!=student_username)
{
f<<"\n";
f<<student_name<<"\t" ;
f<<student_username<<"\t" ;
f<<student_semester<<"\t" ;
f<<student_section<<"\t" ;
f<<challan_no<<"\t" ;
f<<amount<<"\n" ;
}
else
{
std::cout<<" Data was successfully deleted!\n";
}
d>>student_name;
d>>student_username ;
d>>student_semester;
d>>student_section;
d>>challan_no;
d>>amount;
}
d.close();
f.close();
std::remove ("fee.txt");
std::rename("temp.txt","fee.txt");
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
return Accountant::accountant_menu();
default:
exit(0);
}
} while (ch);
}
//submitt fee
void submit_fee()
{
std::string search;
std::cout<<"Enter the username of Student for Submit Fee:"<<"\n";
std::cin>>search;
std::ifstream d;
d.open("fee.txt");
std::ofstream f;
f.open("temp.txt");
d>>student_name;
d>>student_username ;
d>>student_semester;
d>>student_section;
d>>challan_no;
d>>amount;
while(!d.eof())
{
if(search!=student_username)
{
f<<"\n";
f<<student_name<<"\t" ;
f<<student_username<<"\t" ;
f<<student_semester<<"\t" ;
f<<student_section<<"\t" ;
f<<challan_no<<"\t" ;
f<<amount<<"\n" ;
}
else
{
std::cout<<"Remove Student Name from list.Successfully!\n";
}
d>>student_name;
d>>student_username ;
d>>student_semester;
d>>student_section;
d>>challan_no;
d>>amount;
}
d.close();
f.close();
std::remove ("fee.txt");
std::rename("temp.txt","fee.txt");
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
return Accountant::accountant_menu();
default:
exit(0);
}
} while (ch);
}
void submit_fine()
{ int fine;
std::string search;
std::cout<<"Enter the id of Student for Submit Fine:"<<"\n";
std::cin>>search;
std::ifstream d;
d.open("fine.txt");
std::ofstream f;
f.open("temp.txt");
d>>Member_name;
d>>Member_id;
d>>fine;
while(!d.eof())
{
if(search!=Member_id)
{
f<<Member_name<<"\t";
f<<Member_id<<"\t";
f<<fine<<"\n";
}
else
{
std::cout<<"Remove Student fine from list.Successfully!\n";
}
d>>Member_name;
d>>Member_id;
d>>fine;
}
d.close();
f.close();
std::remove ("fine.txt");
std::rename("temp.txt","fine.txt");
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
return Accountant::accountant_menu();
default:
exit(0);
}
} while (ch);
}
};
class Student: public Accountant
{
private:
std::string student_name;
std::string cnic;
std::string User_name;
std::string Name;
int password;
public:
Student ()
{
student_name = "N/A";
cnic = "Null";
User_name = "N/A";
Name="student";
password=123;
}
void student_Password ()
{
int cont;
std::cout<<"\n\t\t\t*********************************************************\n";
std::cout<<"\n\t\t\t\t\t ... Wellcome to Student Profile...\n";
std::cout<<"\n\t\t\t*********************************************************\n\n";
std::cout << "\nIf you want continous press(1/0)";
std::cin>>cont;
if(cont==1)
{
student_menu();
}
else
{
exit(0);
}
}
void student_menu ()
{
std::cout << "\n\t\t\t01.Check your profile:";
std::cout << "\n\t\t\t02.update your profile:";
std::cout << "\n\t\t\t03.Check your Check Course Detail:";
std::cout << "\n\t\t\t04.Check your Fee:";
std::cout << "\n\t\t\t05.Check your Fine:";
std::cout << "\n\t\t\t06.Check your Result:";
std::cout << "\n\t\t\t07.Check your Attendence:";
std::cout << "\n\t\t\t08 Exit:\n";
std::cout << "\n\t\t\t\tEnter the selection:";
int num1;
std::cin >> num1;
switch (num1)
{
case 1:
search_profile();
break;
case 2:
update_profile();
break;
case 3:
check_coursedetail();
break;
case 4:
check_specificfee();
break;
case 5:
check_fine();
break;
case 6:
check_Result();
break;
case 7:
check_attendence();
break;
case 8:
exit(0);
break;
default:
{
std::cout<<"Enter valid selection!\n";
}
}
}
};
class Teacher:public Student
{
protected:
std::string name;
std::string username;
std::string CNIC;
std::string phon_no;
std::string subject;
public:
void password()
{
int cont;
std::cout<<"*****************************************************************************\n";
std::cout<<" WELCOME TO TEACHER DISPLAY \n";
std::cout<<"*****************************************************************************";
std::cout << "\nIf you want continous press(1/0)";
std::cin>>cont;
if(cont==1)
{
teacher_menu();
}
else
{
exit(0);
}
}
teacher_menu()
{
int a;
system("cls");
std::cout << std::endl;
std::cout << "\t\t1>> Add new Teacher \n";
std::cout << "\t\t2>> Search the Teacher \n";
std::cout << "\t\t3>> Show the Teacher \n";
std::cout << "\t\t4>> upate the Teacher data \n";
std::cout << "\t\t5>> Delete the Teacher \n";
std::cout << "\t\t0>> Exit\n";
std::cout << "\t Choice the Option\t:\t";
std::cin >> a;
switch (a)
{
case 1:
create_teacher();
break;
case 2:
search_teacher();
break;
case 3:
show_teacher();
break;
case 4:
update_teacher();
break;
case 5:
remove_teacher();
break;
case 0:
exit(0);
break;
default:
teacher_menu();
break;
}
}
void create_teacher()
{
system("cls");
std::cout << "\n Enter name of Teacher : ";
std::cin >> name;
std::cout << "\n Enter the Teacher username : ";
std::cin>>username;
std::cout << "\n Enter the Teacher CNIC : ";
std::cin>>CNIC;
std::cout << "\n Enter the Teacher Phon-Number : ";
std::cin>>phon_no;
std::cout << "\n Enter The Teacher Subject : ";
std::cin>>subject;
std::cout << "\n Do you wish to save the above details(y/n) : ";
char ch;
std::cin >> ch;
if (ch == 'y')
{
std::ofstream file;
file.open("Teacher.txt", std::ios::app);
if (file.is_open())
{
file << "\n" << name << "\t" << username << "\t" << CNIC << "\t" << phon_no<<"\t"<<subject;
file.close();
}
}
else
{
create_teacher();
}
std::cout << "\nIf you want continous press(1/0)";
int m;
std::cin >> m;
if (m == 1)
{
teacher_menu();
}
}
void search_teacher()
{
system("cls");
std::string c;
std::cout << "Enter the student the Username :";
std::cin >> c;
std::ifstream get;
get.open("Teacher.txt");
if (get.is_open())
{
while (!get.eof())
{
get >> name;
get >> username;
get >> CNIC;
get >> phon_no;
get >> subject;
if (c == username)
{
std::cout << name << "\t" << username << "\t" << CNIC << "\t" << phon_no<<"\t"<<subject<< "\n";
}
}
get.close();
}
std::cout << "\nIf you want continous press(1/0)";
int m;
std::cin >> m;
if (m == 1)
{
exit(0);
}
}
void show_teacher()
{
std::ifstream get;
get.open("Teacher.txt");
if (get.is_open())
{
while (!get.eof())
{
get >> name;
get >> username;
get >> CNIC;
get >> phon_no;
get >> subject;
std::cout << name << "\t" << username << "\t" << CNIC << "\t" << phon_no<<"\t"<<subject<< "\n";
}
get.close();
}
std::cout << "\nIf you want continous press(1/0)";
int m;
std::cin >> m;
if (m == 1)
{
exit(0);
}
}
void update_teacher()
{
system("cls");
std::string c;
std::cout << "Enter the Teacher the Username :";
std::cin >> c;
std::ifstream get;
std::ofstream temp;
get.open("Teacher.txt");
temp.open("temprary.txt");
if (get.is_open())
{
while (!get.eof())
{
get >> name;
get >> username;
get >> CNIC;
get >> phon_no;
get >> subject;
if (c != username)
{
temp << "\n"<< name << "\t" << username << "\t" << CNIC << "\t" << phon_no<<"\t"<<subject;
}
if(c==username)
{
std::cout << "\n Enter name of Teacher : ";
std::cin >> name;
std::cout << "\n Enter the Teacher username : ";
std::cin>>username;
std::cout << "\n Enter the Teacher CNIC : ";
std::cin>>CNIC;
std::cout << "\n Enter the Teacher Phon-Number : ";
std::cin>>phon_no;
std::cout << "\n Enter The Teacher Subject : ";
std::cin>>subject;
temp << "\n"<< name << "\t" << username << "\t" << CNIC << "\t" << phon_no<<"\t"<<subject;
}
}
get.close();
temp.close();
std::remove("Teacher.txt");
std::rename("temprary.txt", "Teacher.txt");
}
std::cout << "\nIf you want continous press(1/0)";
int m;
std::cin >> m;
if (m == 1)
{
exit(0);
}
}
void remove_teacher()
{
system("cls");
std::string c;
std::cout << "Enter the Teacher the Username :";
std::cin >> c;
std::ifstream get;
std::ofstream temp;
get.open("Teacher.txt");
temp.open("temprary.txt");
if (get.is_open())
{
while (!get.eof())
{
get >> name;
get >> username;
get >> CNIC;
get >> phon_no;
get >> subject;
if (c != username)
{
temp << "\n"<< name << "\t" << username << "\t" << CNIC << "\t" << phon_no<<"\t"<<subject;
}
else
{
std::cout<<"Delete Successfully!";
}
}
get.close();
temp.close();
std::remove("Teacher.txt");
std::rename("temprary.txt", "Teacher.txt");
}
std::cout << "\nIf you want continous press(1/0)";
int m;
std::cin >> m;
if (m == 1)
{
exit(0);
}
}
};
class Teacher_attendence:public Teacher
{
protected:
std::string Teacher_name;
std::string Teacher_username;
std::string Semester;
std::string subject;
std::string date;
std::string mark;
int time;
public:
Teacher_attendence()
{
Teacher_name="N/A";
Teacher_username="N/A";
Semester="N/A";
subject="N/A";
date="N/A";
mark="N/A";
time=0;
}
void display_teacher()
{ system("cls");
std::cout<<"\n\t\t**********************************************";
std::cout<<"\n\t\t\t WELCOME TO TEACHER ATTENDENCE";
std::cout<<"\n\t\t**********************************************";
int y;
std::cout<<"\n\n\t\t If You Go To Attendence Menu Press 1 Otherwise press 0::";
std::cin>>y;
if(y==1)
{
attendence_menu();
}
if(y==0)
{
exit(0);
}
}
void attendence_menu()
{
system("cls");
std::cout<<"\n\n\t\t Menu:";
std::cout<<"\n\t\t 01.Create Teacher Attendence Record";
std::cout<<"\n\t\t 02.Check Teacher Attendence Record";
std::cout<<"\n\t\t 03.Search Teacher Attendence Record";
std::cout<<"\n\t\t 04.Update Teacher Attendence Record";
std::cout<<"\n\t\t 05.Removed Teacher Attendence Record";
std::cout<<"\n\t\t 00.Exit ";
std::cout<<"\n\n\t\t 01.Enter the Selection:";
int num;
std::cin>>num;
switch(num)
{
case 1:
create_attendence();
break;
case 2:
check_attendence();
break;
case 3:
search_attendence();
break;
case 4:
update_attendence();
break;
case 5:
Removed_attendence();
break;
default:
{
std::cout<<"\n\t\tEnter the Valid Selection!\n";
break;
}
}
}
void create_attendence()
{
std::string search;
std::cout<<"\n\t\tEnter the Teacher Username:";
std::cin>>search;
std::ofstream emo("Attendence.txt", std::ios::app);
std::ifstream read("Teacher.txt");
while(!read.eof())
{
read>> Teacher_name;
read>> Teacher_username;
read>> subject;
if(search== Teacher_username)
{
std::cout<<"\n\t\t01.Enter Date:";
std::cin>>date;
std::cout<<"\n\t\t01.Enter Time:";
std::cin>>time;
std::cout<<"\n\t\t01.Enter Subject:";
std::cin>>subject;
std::cout<<"\n\t\t01.Enter Mark Attendence (P/A):";
std::cin>>mark;
std::cout<<"\n\t\t01.Enter Semester Name:";
std::cin>>Semester;
emo<<"\n";
emo << Teacher_name<<"\t" ;
emo << Teacher_username<<"\t" ;
emo <<subject<<"\t" ;
emo <<Semester<<"\t" ;
emo <<date<<"\t" ;
emo <<time<<"\t" ;
emo <<mark<<"\t" ;
}
}
emo.close();
read.close();
int ch;
do
{
std::cout << "\n\nDo you want Back in Menu Press'1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return attendence_menu();
default:
exit(0);
}
} while (ch);
}
void check_attendence()
{
std::ifstream take("Attendence.txt");
take>> Teacher_name;
take>> Teacher_username;
take>>Semester;
take>>date;
take>>time;
take>>subject;
take>>mark;
while (!take.eof())
{
std::cout<<"\n\n01.Teacher Name:"<< Teacher_name<<"\t"
<<"03.Teacher username:"<< Teacher_username<<"\n";
std::cout<<"05.Teacher semester:"<<Semester<<"\t"
<<"06.Date:"<<date<<"\n";
std::cout<<"07.Time:"<<time<<"PM"<<"\t\t"<<"08.Subject:"<<subject<<"\t"
<<"09.Attendence Mark:"<<mark<<"\n";
take>> Teacher_name;
take>> Teacher_username;
take>> Semester;
take>>date;
take>>time;
take >> subject;
take>>mark;
}
take.close();
int ch;
do
{
std::cout << "\n\nDo you want Back in Menu Press'1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return attendence_menu();
default:
exit(0);
}
} while (ch);
}
void search_attendence()
{
std::string search;
std::cout << "Enter the Teacher username for search : ";
std::cin >> search;
std::ifstream take("Attendence.txt");
take>> Teacher_name;
take>> Teacher_username;
take>>Semester;
take>>date;
take>>time;
take>>subject;
take>>mark;
while (!take.eof())
{
if (search == Teacher_username)
{
std::cout<<"\n\n01.Teacher Name:"<< Teacher_name<<"\t"
<<"03.Teacher username:"<< Teacher_username<<"\n";
std::cout<<"05.Teacher semester:"<<Semester<<"\t"
<<"06.Date:"<<date<<"\n";
std::cout<<"07.Time:"<<time<<"PM"<<"\t\t"<<"08.Subject:"<<subject<<"\t\t"
<<"09.Attendence Mark:"<<mark<<"\n";
}
take>> Teacher_name;
take>> Teacher_username;
take>> Semester;
take>>date;
take>>time;
take>>subject;
take>>mark;
}
take.close();
}
void update_attendence()
{
std::string search;
std::cout<<"Enter the username of Teacher:"<<"\n";
std::cin>>search;
std::ifstream d;
d.open("Attendence.txt");
std::ofstream f;
f.open("temp.txt");
d>> Teacher_name;
d>> Teacher_username;
d>>Semester;
d>>date;
d>>time;
d>>subject;
d>>mark;
while(!d.eof())
{
if(search!= Teacher_username)
{
f<<"\n";
f<< Teacher_name<<"\t" ;
f<< Teacher_username<<"\t" ;
f<<Semester<<"\t" ;
f<<date<<"\t" ;
f<<time<<"\t" ;
f<<subject<<"\t" ;
f<<mark<<"\t" ;
}
else
{
std::cout<<"Enter the Time:";
std::cin>>time;
std::cout<<"Enter the date:";
std::cin>>date;
std::cout<<"Enter Subject:";
std::cin>>subject;
std::cout<<"Enter update in Attendence Mark:";
std::cin>>mark;
f<<"\n";
f<< Teacher_name<<"\t" ;
f<< Teacher_username<<"\t" ;
f<< Semester<<"\t" ;
f<<date<<"\t" ;
f<<time<<"\t" ;
f<<subject<<"\t" ;
f<<mark<<"\t" ;
}
d>> Teacher_name;
d>> Teacher_username;
d>>Semester;
d>>date;
d>>time;
d>>subject;
d>>mark;
}
d.close();
f.close();
std::remove ("Attendence.txt");
std::rename("temp.txt","Attendence.txt");
int ch;
do
{
std::cout << "\n\nDo you want Back in Menu Press'1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return attendence_menu();
default:
exit(0);
}
} while (ch);
}
void Removed_attendence()
{
std::string search;
std::cout<<"Enter the Username of Teacher for deleted:"<<"\n";
std::cin>>search;
std::ifstream d;
d.open("Attendence.txt");
std::ofstream f;
f.open("temp.txt");
d>> Teacher_name;
d>> Teacher_username;
d>> Semester;
d>>date;
d>>time;
d>>subject;
d>>mark;
while(!d.eof())
{
if(search!= Teacher_username)
{
f<<"\n";
f<< Teacher_name<<"\t" ;
f<< Teacher_username<<"\t" ;
f<<Semester<<"\t" ;
f<<date<<"\t" ;
f<<time<<"\t" ;
f<<subject<<"\t" ;
f<<mark<<"\t" ;
}
else
{
std::cout<<"your data has successfully deleted!\n";
}
d>> Teacher_name;
d>> Teacher_username;
d>>Semester;
d>>date;
d>>time;
d>>subject;
d>>mark;
}
d.close();
f.close();
std::remove ("Attendence.txt");
std::rename("temp.txt","Attendence.txt");
int ch;
do
{
std::cout << "\n\nDo you want Back in Menu Press'1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return attendence_menu();
default:
exit(0);
}
} while (ch);
}
};
class Admin:public Teacher_attendence
{
public:
void display()
{
std::cout<<"\n\t\t*********************************";
std::cout<<"\n\t\t\tWelcome to Admin";
std::cout<<"\n\t\t*********************************";
std::cout<<"\n\t\tAre you soure you Enter (1/0)";
int y;
std::cin>>y;
if(y==1)
{
admin_menu();
}
if(y==0)
{
exit(0);
}
}
void admin_menu()
{
std::cout<<"\n\t\tMenu:";
std::cout<<"\n\t\t01.Check All Teacher";
std::cout<<"\n\t\t02.Search Teacher";
std::cout<<"\n\t\t03.update Teacher";
std::cout<<"\n\t\t04.Delete Teacher";
std::cout<<"\n\t\t05.Check All Student";
std::cout<<"\n\t\t06.Search Student";
std::cout<<"\n\t\t07.Update Student ";
std::cout<<"\n\t\t08.Delete Student";
std::cout<<"\n\t\t09.Exit";
int num;
std::cout<<"\n\t\t Enter the Selection:";
std::cin>>num;
switch(num)
{
case 1:
show_teacher();
break;
case 2:
search_teacher();
break;
case 3:
update_teacher();
break;
case 4:
remove_teacher();
break;
case 5:
show_profile();
break;
case 6:
search_profile();
break;
case 7:
update_profile();
break;
case 8:
remove_profile();
break;
case 9:
exit(0);
break;
default:
{
std::cout<<"Enter the Valid Selection:";
break;
}
}
}
};
class Member:public Admin
{
protected:
std::string pick;
std::string stdname;
std::string regnum;
public:
void Display_menu()
{
int cont;
std::cout<<"\n\t\t**********************************************";
std::cout<<"\n\t\t\t WELCOME TO MEMBER LIBRARY";
std::cout<<"\n\t\t**********************************************";
std::cout << "\nIf you want continous press(1/0)";
std::cin>>cont;
if(cont==1)
{
show_menu();
}
else
{
exit(0);
}
}
void show_menu()
{
std::cout << "Wellcome to Menu";
std::cout << "\n\t\t\t01 :CHECK YOUR PROFILE";//relate
std::cout << "\n\t\t\t02 :SEE ALL BOOKS";//relate
std::cout << "\n\t\t\t03 :SEARCH SPECIFIC BOOK ";//relate
std::cout << "\n\t\t\t04 :BORROW SPECIFIC BOOK ";
std::cout << "\n\t\t\t05 :SHOW FINE";
std::cout << "\n\t\t\t06 :SUBMIT FINE";
std::cout << "\n\t\t\t0 : Exit";
int num;
std::cin >> num;
switch (num) {
case 1:
search();
break;
case 2:
allbook();
break;
case 3:
searchb();
break;
case 4:
CUSTOMER_BUY();
break;
case 5:
check_fine();
break;
case 6:
submit_fine();
break;
case 0:
exit(0);
break;
default: {
show_menu();
}
}
}
void CUSTOMER_BUY()
{
system("cls");
int choice; //declare variables
int num = 0;
double total = 0;
std::string input = "Y"; //default input is yes
std::string input2, input3, input4;
int search;
std::cout << "Enter the Book ID for search:";
std::cin >> search;
int q = 0;
std::ifstream take("book.txt");
if (take.is_open())
{
take >> Book_name;
take >> Book_Author;
take >> Book_id;
while (!take.eof())
{
take >> Book_name;
take >> Book_Author;
take >> Book_id;
if (search == Book_id)
{
std::cout << Book_name << "\t" << Book_Author << "\t" << Book_id << std::endl;
break;
}
}
take.close();
}
else
{
std::cout << "File error\n";
}
bool k;
std::cout << "if u want to borrow press(1/0)";
std::cin >> k;
if (k ==1)
{
std::cout << "\n\t\t THANK YOU";
std::cout << "\n\t THEN YOU HAVE TO RETURN BEFORE 30 DAYS OTHER WISE U WILL HAVE TO PAY FINE WITH 100 PER DAY";
}
}
};
class Admission_office:public Member
{
protected:
std::string student_name;
std::string father_name;
std::string student_phone;
std::string student_cnic;
std::string student_username;
std::string kinship;
int admission_no;
int discount;
public:
Admin_office()
{
student_name="NULL";
father_name="NULL";
student_phone="NULL";
student_cnic="NULL";
student_username="NULL";
kinship="NULL";
admission_no=0;
discount=0;
}
void Admission_password()
{
std::cout<<"\n\t\t\t*********************************************************\n";
std::cout<<"\n\t\t\t\t\t ... Wellcome to Admission_office...\n";
std::cout<<"\n\t\t\t*********************************************************\n\n";
int cont;
std::cout << "\nIf you want continous press(1/0)";
std::cin>>cont;
if(cont==1)
{
admission_menu();
}
else
{
exit(0);
}
}
void admission_menu()
{
system("cls");
std::cout<<"\n\t\t Wellcome To Admission_Office\n";
std::cout<<"\n\t\t01. Create Admission Form";
std::cout<<"\n\t\t02. Check Admission Form";
std::cout<<"\n\t\t03. Search Admission Form";
std::cout<<"\n\t\t04. Delete Admission Form";
std::cout<<"\n\t\t05. Check Teacher Details";
std::cout<<"\n\t\t06. Check Student Details";
std::cout<<"\n\t\t00. Exit\n";
std::cout<<"\n\t\t Enter your selection:";
int num;
std::cin>>num;
switch(num)
{
case 1:
create_form();
break;
case 2:
check_form();
break;
case 3:
search_form();
break;
case 4:
delete_form();
break;
case 5:
show_teacher();
break;
case 6:
show_profile();
break;
case 0:
exit(0);
default:
{
std::cout<<"\tPlease Enter valid choice!\n";
}
}
}
void create_form()
{
std::ofstream write("abc.txt", std::ios::app);
if (write.is_open())
{ std::cout << "\n\n\t Enter the information for Admission_form\n ";
std::cout<<"Enter the Name of student:"<<"\n";
std::cin>>student_name;
std::cout<<"Enter the Father Name :"<<"\n";
std::cin>>father_name;
std::cout<<"Enter the Username of student:"<<"\n";
std::cin>>student_username;
std::cout<<"Enter the phone number :"<<"\n";
std::cin>>student_phone;
std::cout<<"Enter the Student CNIC :"<<"\n";
std::cin>>student_cnic;
std::cout<<"Enter kinship Name of Student :"<<"\n";
std::cin>>kinship;
std::cout<<"Enter Discount in Fee :"<<"\n";
std::cin>>discount;
write<<"\n";
write <<student_name<<"\t" ;
write <<father_name<<"\t" ;
write <<student_username<<"\t" ;
write <<student_phone<<"\t" ;
write <<student_cnic<<"\t" ;
write <<kinship<<"\t" ;
write <<discount<<"\n" ;
}
else
{
std::cout << "error" << " \t\t";
}
write.close();
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
return admission_menu();
default:
exit(0);
}
} while (ch);
}
void check_form()
{
std::ifstream take("abc.txt");
take>>student_name;
take>>father_name;
take>>student_username;
take>>student_phone;
take>>student_cnic;
take>>kinship;
take>>discount;
while (!take.eof())
{
std::cout<<"01 Student_name:"<<student_name<<"\t"<<"02 father_name:"
<<father_name<<"\t"<<"03 Student_username:"<<student_username<<"\t"<<"04 kinship:"<<kinship<<"\n";
std::cout<<"05 Student phone:"<<student_phone<<"\t"<<"06 Student_CNIC:"
<<student_cnic<<"\t"<<"\t"<<"07 Discount:"<<discount<<"\n\n";
take>>student_name;
take>>father_name;
take>>student_username;
take>>student_phone;
take>>student_cnic;
take>>kinship;
take>>discount;
}
take.close();
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
return admission_menu();
default:
exit(0);
}
} while (ch);
}
void search_form()
{
std::string search;
std::cout << "Enter the Username of Student for search:";
std::cin >> search;
std::ifstream take("abc.txt");
if (take.is_open())
{
take>>student_name;
take>>father_name;
take>>student_username;
take>>student_phone;
take>>student_cnic;
take>>kinship;
take>>discount;
while (!take.eof())
{
if (search == student_username)
{
std::cout<<"01 Student_name:"<<student_name<<"\t"<<"02 father_name:"
<<father_name<<"\t"<<"03 Student_username:"<<student_username<<"\t"<<"04 kinship:"<<kinship<<"\n";
std::cout<<"05 Student phone:"<<student_phone<<"\t"<<"06 Student_CNIC:"
<<student_cnic<<"\t"<<"\t"<<"07 Discount:"<<discount<<"\n\n";
break;
}
take>>student_name;
take>>father_name;
take>>student_username;
take>>student_phone;
take>>student_cnic;
take>>kinship;
take>>discount;
}
take.close();
}
else
{
std::cout << "File error\n";
}
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
return admission_menu();
default:
exit(0);
}
} while (ch);
}
void delete_form()
{
std::string search;
std::cout<<"Enter the username of Student for Deleted:"<<"\n";
std::cin>>search;
std::ifstream d;
d.open("abc.txt");
std::ofstream f;
f.open("temp.txt");
d>>student_name;
d>>father_name;
d>>student_username;
d>>student_phone;
d>>student_cnic;
d>>kinship;
d>>discount;
while(!d.eof())
{
if(search!=student_username)
{
f<<"\n";
f<<student_name<<"\t" ;
f<<father_name<<"\t" ;
f<<student_username<<"\t" ;
f<<student_phone<<"\t" ;
f<<student_cnic<<"\t" ;
f<<kinship<<"\t" ;
f<<discount<<"\n" ;
}
else
{
std::cout<<" Data was successfully deleted!\n";
}
d>>student_name;
d>>father_name;
d>>student_username;
d>>student_phone;
d>>student_cnic;
d>>kinship;
d>>discount;
}
d.close();
f.close();
std::remove ("abc.txt");
std::rename("temp.txt","abc.txt");
int ch;
do
{
std::cout << "\n\nIf you want to back Menu press(1/0): ";
std::cin >> ch;
switch (ch)
{
case 1:
return admission_menu();
default:
exit(0);
}
} while (ch);
}
};
class Employee:public Admission_office
{
private:
std::string name;
int code;
int age;
int sal;
int exp;
public:
void Display_m()
{
int cont;
std::cout<<"\n\t\t**********************************************";
std::cout<<"\n\t\t\t WELCOME TO EMPLOYEE MANAGMENT SYSTEM";
std::cout<<"\n\t\t**********************************************";
std::cout << "\nIf you want continous press(1/0)";
std::cin>>cont;
if(cont==1)
{
menu();
}
else
{
exit(0);
}
}
void menu()
{
system("cls");
std::cout<<"\n\n\t\t Welcome to Employee Menu:";
std::cout << "\n1>To add an employee details";
std::cout << "\n2>To see list of employee details";
std::cout << "\n3>To edit an employee details";
std::cout << "\n4>To remove an employee details from list";
std::cout << "\n5>To see details of a employee";
std::cout << "\n0>Exit:";
std::cout << "\n\n\n\n Choose your optiion : ";
int ab;
std::cin >> ab;
system("cls");
switch (ab)
{
case 1:
add_employee();
break;
case 2:
view_employee();
break;
case 3:
edit();
break;
case 4:
del();
break;
case 5:
search();
break;
case 0:
return;
default:
std::cout << "Invalid Option";
break;
}
}
void add_employee()
{
std::cout << "\n Enter name of employee: ";
std::cin >> name;
std::cout << "\n Enter code of employee : ";
std::cin >> code;
std::cout << "\n Enter age of employee : ";
std::cin >> age;
std::cout << "\n Enter salary of employee : ";
std::cin >> sal;
std::cout << "\n Enter expierence of employee : ";
std::cin >> exp;
std::cout << "\n Do you wish to save the above details(y/n) : ";
char ch;
std::cin >> ch;
if (ch == 'y')
{
std::fstream file;
file.open("employee.text", std::ios::app);
if (file.is_open())
{
//file <<"Name\t\tCode\t\tage\t\tExperiance\t\tSalery\n";
file << "\n" << name << "\t\t" << code << "\t\t" << age << "\t\t" << exp << "\t\t\t" << sal;
}
else
{
std::cout << "error";
}
}
else
{
add_employee();
}
menu();
}
void view_employee()
{
std::fstream file;
file.open("employee.text", std::ios::in);
if (file.is_open())
{
std::cout << "Name\t\tCode\t\tage\t\tExperiance\t\tSalery\n";
while (!file.eof())
{
file >> name;
file >> code;
file >> age;
file >> exp;
file >> sal;
std::cout << "\n \t" << name << "\t" << code << "\t" << age << "\t" << exp << "\t" << sal << "\n";
}
}
file.close();
system("pause");
menu();
}
void del()
{
system("cls");
std::cout << "Enter the employee id which you want Delete\t:\t ";
int co;
std::cin >> co;
std::fstream file;
std::fstream temp;
temp.open("temp.text", std::ios::out);
file.open("employee.text", std::ios::in | std::ios::app);
while (!file.eof())
{
file >> name;
file >> code;
file >> age;
file >> exp;
file >> sal;
if (code != co)
{
temp << name << "\t\t\t" << code << "\t\t\t" << age << "\t\t" << exp << "\t\t\t" << sal << "\n";
}
}
temp.close();
file.close();
std::remove("employee.text");
std::rename("temp.text", "employee.text");
system("pause");
menu();
}
void edit()
{
std::cout << "Enter the employee id which you want Edit\t:\t ";
int co;
std::cin >> co;
std::fstream file;
std::fstream temp;
temp.open("temp.text", std::ios::out);
file.open("employee.text", std::ios::in | std::ios::app);
while (!file.eof())
{
file >> name;
file >> code;
file >> age;
file >> exp;
file >> sal;
if (code != co)
{
temp << name << "\t\t\t" << code << "\t\t\t" << age << "\t\t" << exp << "\t\t\t" << sal << "\n";
}
else
{
std::cout << "\n Enter name of employee : ";
std::cin >> name;
std::cout << "\n Enter code of employee : ";
std::cin >> code;
std::cout << "\n Enter age of employee : ";
std::cin >> age;
std::cout << "\n Enter salary of employee : ";
std::cin >> sal;
std::cout << "\n Enter expierence of employee : ";
std::cin >> exp;
temp << name << "\t\t\t" << code << "\t\t\t" << age << "\t\t" << sal << "\t\t" << exp << "\n";
}
}
temp.close();
file.close();
std::remove("employee.text");
std::rename("temp.text", "employee.text");
system("pause");
menu();
}
void search()
{
int flag = 0;
system("cls");
std::cout << "Enter the employee code";
int co;
std::cin >> co;
std::ifstream file;
file.open("employee.text");
std::cout << "Name\t\tCode\t\tage\t\tExperiance\t\tSalery\n";
while (!file.eof())
{
file >> name;
file >> code;
file >> age;
file >> exp;
file >> sal;
if (code == co)
{
flag = 1;
std::cout << "\n" << name << "\t\t" << code << "\t\t" << exp << "\t\t" << age << "\t\t\t" << sal;
}
}
if (flag == 0)
{
std::cout << "not found";
}
file.close();
system("pause");
menu();
}
};
class coordinator:public Employee
{
private:
std::string COORDINATOR_NAME;
public:
void cord_display()
{
std::cout << "\t\t*************************************************\n";
std::cout << " \t \t WELCOME TO CORDINATOR DOMAIN\n";
std::cout << "\t\t*************************************************\n";
std::cout << "\tAre u sure u want to enter CORDINATOR-MENU then press 1 else 0\n";
bool k;
std::cin >> k;
if (k == 1)
{
cordinator_menu();
}
if (k == 0)
{
exit(0);
}
}
void cordinator_menu()
{
system("cls");
std::cout << "\t\t*************************************************\n";
std::cout << " \t \t WELCOME TO CORDINATOR MENU\n";
std::cout << "\t\t*************************************************\n";
std::cout << "\n\t\t\t\t01.Check All Student: ";
std::cout << "\n\t\t\t\t02.Search Student:";
std::cout << "\n\t\t\t\t03.Search Teacher:";
std::cout << "\n\t\t\t\t04.Check All Teacher:";
std::cout << "\n\t\t\t\t05.Check All Employe:";
std::cout << "\n\t\t\t\t06.Specific Employe:";
std::cout << "\n\t\t\t\t07.Exit";
int num;
std::cin >> num;
switch (num)
{
case 1:
show_profile();
break;
case 2:
search_profile();
break;
case 3:
search_teacher();
break;
case 4:
show_teacher();
break;
case 5:
view_employee();
break;
case 6:
search();
break;
case 7:
exit(0);
break;
default:
{
std::cout<<"\n\t\tEnter the Valid Selection:";
}
}
}
};
class Computer_lab{
protected:
std::string Chief_name;
std::string Chief_CNIC;
std::string Chief_Username;
int mouse,keyboard,CPU;
int ab;
public:
Computer_lab()
{
Chief_name="NULL";
Chief_CNIC="NULL";
Chief_Username="NULL";
mouse=0;
keyboard=0;
CPU=0;
}
void lab_password()
{
std::string use;
std::string pass;
std::cout<<"\n\t\t**********************************************";
std::cout<<"\n\t\t\t WELCOME TO COMPUTER LIBRARY";
std::cout<<"\n\t\t**********************************************";
std::cout << "\n 1 Admin\n";
std::cout << "\n 2 Teacher OR Student\n";
int ch;
std::cin >> ch;
if (ch == 1)
{
for(int z=1;z<4;z++)
{
std::cout<<"\nEnter the Username\t:\t";
std::cin>>use;
std::cout<<"\nEnter the Password\t:\t";
std::cin>>pass;
if(use=="user"&&pass=="pass")
{
ab=1;
Admin();
break;
}
else
{
std::cout<<"\n\t\tWrong Password/username";
}
}
}
if(ch==2)
{
student();
}
}
void Admin()
{
system("cls");
int num2;
std::cout << "\n\n\n\t\t LAB_MENU:\n";
std::cout << "\n\n\n\t01.Create_CHIEF_PROFILE:";
std::cout << "\n\n\n\t02.Delete_CHIEF_PROFILE:";
std::cout << "\n\n\n\t03.Create Lab_ACCESSORIES:";
std::cout << "\n\n\n\t04.View Lab_ACCESSORIES:";
std::cout << "\n\n\n\t05.Delete Lab_ACCESSORIES:";
std::cout << "\n\n\n\t06.Create Lab Revenue:";
std::cout << "\n\n\n\t07.Check Lab Revenue:";
std::cout <<"\n\n\n\t08: Exit:";
std::cout << "\n\n\n\t Enter the Selection:"<<" ";
std::cin >> num2;
switch (num2)
{
case 1:
Create_cheif();
break;
case 2:
Delete_cheif();
break;
case 3:
create_accessories();
break;
case 4:
view_accessories();
break;
case 5:
delete_accessories();
break;
case 6:
create_Revenue();
break;
case 7:
check_Revenue();
break;
case 8:
exit(0);
default:
std::cout << "Invalid choice, Please try again";
}
}
void student()
{
system("cls");
int num2;
std::cout << "\n\n\n\t\t LAB_MENU:\n";
std::cout << "\n\n\n\t04.View Lab_ACCESSORIES:";
std::cout <<"\n\n\n\t00: Exit:";
std::cout << "\n\n\n\t Enter the Selection:"<<" ";
std::cin >> num2;
switch (num2)
{
case 1:
view_accessories();
break;
case 0:
exit(0);
default:
std::cout << "Invalid choice, Please try again Letter";
}
}
//1create chief profile
void Create_cheif()
{
std::ofstream Ch("Ch.txt", std::ios::app);
if (Ch.is_open())
{ std::cout << "\n\n\t Enter the Chief Information \n ";
std::cout<<"Enter the Name of Chief:"<<"\n";
std::cin>>Chief_name;
std::cout<<"Enter the Username of Chief:"<<"\n";
std::cin>>Chief_Username;
std::cout<<"Enter the CNIC number of Chief:"<<"\n";
std::cin>>Chief_CNIC;
Ch <<Chief_name<<"\t"<<Chief_Username<<"\t"<<Chief_CNIC<<"\n" ;
}
else
{
std::cout << "error" << " \t\t";
}
Ch.close();
int ch;
do
{
std::cout << "\n\nIf you want to add more records tan enter '1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return Admin();
default:
exit(0);
}
} while (ch);
}
//2Delete CHief profile...
void Delete_cheif()
{
std::string deleteline;
std::string line;
std::ifstream fin("Ch.txt");
if (!fin.is_open()) {
std::cout << "Input file failed to open\n";
}
std::ofstream temp("temp.txt");
std::cout << "Enter the line for deleted:" << std::endl;
std::cin >> deleteline;
while (getline(fin, deleteline)) {
if (line != deleteline)
temp << line << std::endl;
}
std::cout<<"your data successfully deleted!\n";
fin.close();
temp.close();
std::remove("Ch.txt");
std::rename("temp.txt", "Ch.txt");
int ch;
do
{
std::cout << "\n\nIf you want to continue than enter '1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return Admin();
default:
exit(0);
}
} while (ch);
}
//3Create lab accessories
void create_accessories()
{
std::ofstream red("write.txt", std::ios::app);
if (red.is_open())
{ std::cout << "\n\n\t Enter the lab_accessories Information \n ";
std::cout<<"Enter the amount of Mouse are used in lab:"<<"\n";
std::cin>>mouse;
std::cout<<"Enter the amount of keyboard are used in lab:"<<"\n";
std::cin>>keyboard;
std::cout<<"Enter the amount of CPU are used in lab:"<<"\n";
std::cin>>CPU;
red<<mouse<<"\t"<<keyboard<<"\t"<<CPU<<std::endl;
}
else
{
std::cout << "error" << " \t\t";
}
red.close();
int ch;
do
{
std::cout << "\n\nIf you want to add more records tan enter '1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return Admin();
default:
exit(0);
}
} while (ch);
}
//4view lab accessories
void view_accessories()
{
system("cls");
std::ifstream take("write.txt");
if (take.is_open())
{
take>>mouse>>keyboard>>CPU;
while (!take.eof())
{
std::cout<<"Total mouse:"<<mouse<<"\t"<<"Total keyboard:"<<keyboard<< "\t"<<"Total CPU:"<<CPU<<std::endl;
take >>mouse>>keyboard>>CPU;
}}
int ch;
std::cout << "\n\nIf you want to add more records tan enter '1' else '0'";
std::cin >> ch;
if(ch==0)
{
if(ab==1)
{
Admin();
}
else
{
student();
}
}
}
//5 delete data of lab accessories
void delete_accessories()
{
std::string deleteline;
std::string line;
std::ifstream fin("write.txt");
if (!fin.is_open()) {
std::cout << "error\n";
}
std::ofstream temp("temp.txt");
std::cout << "Enter the line for deleted:" << std::endl;
std::cin >> deleteline;
while (getline(fin, deleteline)) {
if (line != deleteline)
temp << line << std::endl;
}
std::cout<<"your data successfully deleted!\n";
fin.close();
temp.close();
std::remove("write.txt");
std::rename("temp.txt", "write.txt");
int ch;
do
{
std::cout << "\n\nIf you want to continue than enter '1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return Admin();
default:
exit(0);
}
} while (ch);
}
//6Create Revenue of computer LAb..
void create_Revenue()
{
int profit,loss,total_amount,Total=0;
Total=profit-loss;
std::ofstream go("Rev.txt", std::ios::app);
if (go.is_open())
{ std::cout << "\n\n\t Enter the lab_accessories Information \n ";
std::cout<<"Enter the Total amount for used in Lab:"<<"\n";
std::cin>>total_amount;
std::cout<<"Enter the Profit of Lab:"<<"\n";
std::cin>>profit;
std::cout<<"Enter the Loss of Lab:"<<"\n";
std::cin>>loss;
go<<total_amount<<"\t"<<profit<<"\t"<<loss<<"\t"<<Total<<"\n";
}
else
{
std::cout << "error" << " \t\t";
}
go.close();
int ch;
do
{
std::cout << "\n\nIf you want to add more records tan enter '1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return Admin();
default:
exit(0);
}
} while (ch);
}
//8check the revenue of computer lab..
void check_Revenue()
{
int profit,loss,total_amount,Total=0;
Total=profit-loss;
std::ifstream take("rev.txt");
if (take.is_open())
{
take >>total_amount ;
take >>profit;
take >>loss;
take >>Total;
while (!take.eof())
{
std::cout <<"Total amount:"<<total_amount<< "\t"<<"Profit_lab:"<<profit<<"%"<< "\t"<<"Loss_lab:"<<loss<<"%"
<<"\t"<<"Total_revenue:"<<Total<<"%"<<std::endl;
take >>total_amount ;
take >>profit;
take >>loss;
take >>Total;
break;
}}
int ch;
do
{
std::cout << "\n\nIf you want to add more records tan enter '1' else '0'";
std::cin >> ch;
switch (ch)
{
case 1:
return Admin();
default:
exit(0);
}
} while (ch);
}
};
class Hostel
{
protected:
std::string name;
std::string roll_no;
std::string city;
std::string phon_no;
int room_no;
int ad;
public:
void Password_H()
{
std::string use;
std::string pass;
std::cout<<"*****************************************************************************\n";
std::cout<<" Welcom To The Hostal system \n";
std::cout<<"*****************************************************************************";
std::cout << "\n 1 admin\n";
std::cout << "\n 2 student\n";
int ch;
std::cin >> ch;
if (ch == 1)
{
for(int z=1;z<4;z++)
{
std::cout<<"\nEnter the Username\t:\t";
std::cin>>use;
std::cout<<"\nEnter the Password\t:\t";
std::cin>>pass;
if(use=="user"&&pass=="pass")
{
ad=1;
Admin();
break;
}
else
{
std::cout<<"\n\t\tWrong Password/username";
}
}
}
if(ch==2)
{
student();
}
}
void Admin()
{
system("cls");
int choice;
std::cout<<"\n\n\t\t\tHOSTEL MANAGEMENT SYSTEM";
std::cout<<"\n\n\n\t\tWELCOME TO THE MAIN MENU";
std::cout<<"\n\n\t\t1>> Enter new Student's data";
std::cout<<"\n\t\t2>> Update information of existing account";
std::cout<<"\n\t\t3>> Search the details of existing account";
std::cout<<"\n\t\t4>> Removing existing account";
std::cout<<"\n\t\t5>> View all students list";
std::cout<<"\n\t\t0>> Exit";
std::cout<<"\n\n\n\n\n\t\t Enter your choice:";
std::cin>>choice;
switch(choice)
{
case 1:
new_entry();
break;
case 2:
edit_H();
break;
case 3:
search_H();
break;
case 4:
erase();
break;
case 5:
view_list();
break;
case 0:
exit(0) ;
break;
break;
default:
Admin();
}
}
void student()
{
system("cls");
int choice;
std::cout<<"\n\n\t\t\tHOSTEL MANAGEMENT SYSTEM";
std::cout<<"\n\n\n\t\tWELCOME TO THE MAIN MENU";
std::cout<<"\n\t\t1>> Search the details of existing account";
std::cout<<"\n\t\t2>> View all students list";
std::cout<<"\n\t\t0>> Exit";
std::cout<<"\n\n\n\n\n\t\t Enter your choice:";
std::cin>>choice;
switch(choice)
{
case 1:
search_H();
break;
case 2:
view_list();
break;
case 0:
exit(0);
break;
default:
student();
}
}
void new_entry()
{
system("cls");
std::ofstream file;
file.open("Hostal.text",std::ios::app);
if(file.is_open())
{
std::cout<<"\n\t\t\tAdd the new student data";
std::cout<<"\n\tEnter the Student Name :\t";
std::cin>>name;
std::cout<<"\n\tEnter the Student Roll-No :\t";
std::cin>>roll_no;
std::cout<<"\n\tEnter the Student city :\t";
std::cin>>city;
std::cout<<"\n\tEnter the Student room-NO :\t";
std::cin>>room_no;
std::cout << "\n Do you wish to save the above details(y/n) : ";
char ch;
std::cin >> ch;
if (ch == 'y')
{
file<<"\n"<<name<<"\t\t"<<roll_no<<"\t\t"<<city<<"\t\t"<<room_no;
file.close();
}
else
{
new_entry();
}
int x;
std::cout<<"\nIf you want to continous (1/0)";
std::cin>>x;
if(x==1)
{
Admin();
}
}
}
void edit_H()
{
system("cls");
int z;
std::cout<<"Enter the Room No \t:\t";
std::cin>>z;
std::ifstream get;
std::ofstream temp;
get.open("Hostal.text");
temp.open("temp.text");
if(temp.is_open())
{
if(get.is_open())
{
while(!get.eof())
{
get >> name;
get >>roll_no;
get >>city;
get >>room_no;
if(z!=room_no)
{
temp<<name<<"\t\t"<<roll_no<<"\t\t"<<city<<"\t\t"<<room_no;
}
else
{
std::cout<<"\n\t\t\tAdd the new student data";
std::cout<<"\n\tEnter the Student Name :\t";
std::cin>>name;
std::cout<<"\n\tEnter the Student Roll-No :\t";
std::cin>>roll_no;
std::cout<<"\n\tEnter the Student city :\t";
std::cin>>city;
std::cout<<"\n\tEnter the Student room-NO :\t";
std::cin>>room_no;
temp<<name<<"\t\t"<<roll_no<<"\t\t"<<city<<"\t\t"<<room_no;
}
}
}
else
{
std::cout<<"file not open";
}
get.close();
temp.close();
std::remove("Hostal.text");
std::rename("temp.text","Hostal.text");
}
else
{
std::cout<<"temp file not open";
}
int x;
std::cout<<"\nIf you want to continous (1/0)";
std::cin>>x;
if(x==1)
{
Admin();
}
}
void search_H()
{
system("cls");
int z;
std::cout<<"Enter the Room No \t:\t";
std::cin>>z;
std::ifstream get;
get.open("Hostal.text");
if(get.is_open())
{
std::cout<<"Name\t\tRoll_No\t\tcity\t\tRoom_NO\n";
while(!get.eof())
{
get >> name;
get >>roll_no;
get >>city;
get >>room_no;
if(z==room_no)
{
std::cout<<name<<"\t\t"<<roll_no<<"\t\t"<<city<<"\t\t"<<room_no;
}
}
}
else
{
std::cout<<"file not open";
}
get.close();
int x;
std::cout<<"\nIf you want to continous (1/0)";
std::cin>>x;
if(x==1)
{
if(ad==1)
{
Admin();
}
else
{
student();
}
}
}
void erase()
{
system("cls");
int z;
std::cout<<"Enter the Room No \t:\t";
std::cin>>z;
std::ifstream get;
std::ofstream temp;
get.open("Hostal.text");
temp.open("temp.text");
if(temp.is_open())
{
if(get.is_open())
{
while(!get.eof())
{
get >> name;
get >>roll_no;
get >>city;
get >>room_no;
if(z!=room_no)
{
temp<<"\n"<<name<<"\t\t"<<roll_no<<"\t\t"<<city<<"\t\t"<<room_no;
}
}
}
else
{
std::cout<<"file not open";
}
get.close();
temp.close();
std::remove("Hostal.text");
std::rename("temp.text","Hostal.text");
std::cout<<"Delete Succesfully";
}
else
{
std::cout<<"temp file not open";
}
int x;
std::cout<<"\nIf you want to continous (1/0)";
std::cin>>x;
if(x==1)
{
Admin();
}
}
void view_list()
{
system("cls");
std::ifstream get;
get.open("Hostal.text");
if(get.is_open())
{
std::cout<<"Name\t\tRoll_No\t\tcity\t\tRoom_NO\n";
while(!get.eof())
{
get >> name;
get >>roll_no;
get >>city;
get >>room_no;
std::cout<<"\n"<<name<<"\t\t"<<roll_no<<"\t\t"<<city<<"\t\t"<<room_no;
}
get.close();
}
else
{
std::cout<<"file not open";
}
int x;
std::cout<<"\nIf you want to continous (1/0)";
std::cin>>x;
if(x==1)
{
if(ad==1)
{
Admin();
}
else
{
student();
}
}
}
};
class Transport
{
protected:
std::string name;
std::string roll_no;
std::string card_no;
std::string bus_root;
int ab;
int rent;
public:
void password_t()
{
std::string use;
std::string pass;
std::cout<<"*****************************************************************************\n";
std::cout<<" Welcom To The Transport system \n";
std::cout<<"*****************************************************************************";
std::cout << "\n 1 admin\n";
std::cout << "\n 2 student\n";
int ch;
std::cin >> ch;
if (ch == 1)
{
for(int z=1;z<4;z++)
{
std::cout<<"\nEnter the Username\t:\t";
std::cin>>use;
std::cout<<"\nEnter the Password\t:\t";
std::cin>>pass;
if(use=="user"&&pass=="pass")
{
ab=1;
Admin();
break;
}
else
{
std::cout<<"\n\t\tWrong Password/username";
}
}
}
if(ch==2)
{
student();
}
}
void Admin()
{
int a;
system("cls");
std::cout<<std::endl;
std::cout<<"\t\t1>> Bus Root\n";
std::cout<<"\t\t2>> Add Student in transport \n";
std::cout<<"\t\t3>> Search Student in transport \n";
std::cout<<"\t\t4>> Remove Student in transport \n";
std::cout<<"\t\t5>> Show Student in transport \n";
std::cout<<"\t\t6>> Transport Expenditure\n";
std::cout<<"\t\t7>> Transport Revenue\n";
std::cout<<"\t\t0>> Exit\n";
std::cout<<"\t Choice the Option\t:\t";
std::cin>>a;
switch (a)
{
case 1:
root();
break;
case 2:
add_student();
break;
case 3:
search_student();
break;
case 4:
remove_student();
break;
case 5:
show_student();
break;
case 6:
expend();
break;
case 7:
reve();
break;
case 0:
exit(0);
default:
Admin();
break;
}
}
void student()
{
int a;
system("cls");
std::cout<<std::endl;
std::cout<<"\t\t1>> Bus Root\n";
std::cout<<"\t\t3>> Search Student in transport \n";
std::cout<<"\t\t5>> Show Student in transport \n";
std::cout<<"\t\t0>> Exit\n";
std::cout<<"\t Choice the Option\t:\t";
std::cin>>a;
switch (a)
{
case 1:
root();
break;
case 2:
search_student();
break;
case 3:
show_student();
break;
case 0:
exit(0);
default:
student();
break;
}
}
void root()
{
system("cls");
std::ifstream get;
get.open("Transport.text");
if(get.is_open())
{
std::cout<<"\n\t\tList of the Bus Root ";
std::cout<<"\n\t\tLahore";
std::cout<<"\t\tKasour";
std::cout<<"\t\tPatoki";
std::cout<<"\n\t\tManga";
std::cout<<"\t\tRaiwind";
std::cout<<"\t\tDHA";
std::cout<<"\n\t\tKahna";
std::cout<<"\t\tNashtar";
std::cout<<"\t\tAraiye";
std::cout<<"\n-------------------------------------------------------------------------------";
std::cout<<" \n\t\tList of the Student ";
std::cout<<"\n\n\n\nName\t\tRoot\t\tRoll No\t\tCard No";
while(!get.eof())
{
get>>name;
get>>bus_root;
get>>roll_no;
get>>card_no;
std::cout << "\n" << name << "\t\t" << bus_root<<"\t\t"<<roll_no<<"\t\t"<<card_no;
}
get.close();
}
std::cout<<"\nIf you want continous press(1/0)";
int m;
std::cin>>m;
if(m==1)
{
if(ab==1)
{
Admin();
}
else
{
student();
}
}
}
void add_student()
{
system("cls");
std::cout << "\n Enter name of Student : ";
std::cin >> name;
std::cout << "\n Enter Bus root of student : ";
std::cin >> bus_root;
std::cout << "\n Enter Roll No of Student : ";
std::cin >> roll_no;
std::cout << "\n Enter Transport Card No of Student : ";
std::cin >> card_no;
std::cout << "\n Do you wish to save the above details(y/n) : ";
char ch;
std::cin >> ch;
if (ch == 'y')
{
std::ofstream file;
file.open("Transport.text",std::ios::app);
if(file.is_open())
{
file << "\n" << name << "\t\t" << bus_root << "\t\t" << roll_no << "\t\t" << card_no ;
file.close();
}
}
else
{
add_student();
}
std::cout<<"\nIf you want continous press(1/0)";
int m;
std::cin>>m;
if(m==1)
{
Admin();
}
}
void search_student()
{
system("cls");
std::string c;
std::cout<<"Enter the student Transport card no which you want search:";
std::cin>>c;
std::ifstream get;
get.open("Transport.text");
if(get.is_open())
{
std::cout<<"Name\t\tBus Root\tRoll No\t\tCard NO";
while(!get.eof())
{
get>>name;
get>>bus_root;
get>>roll_no;
get>>card_no;
if(c == card_no)
{
std::cout << "\n" << name << "\t\t" << bus_root << "\t\t" << roll_no << "\t\t" << card_no ;
}
}
get.close();
}
std::cout<<"\nIf you want continous press(1/0)";
int m;
std::cin>>m;
if(m==1)
{
if(ab==1)
{
Admin();
}
else
{
student();
}
}
}
void remove_student()
{
system("cls");
std::string c;
std::cout<<"Enter the student Transport card no which you want Delete:";
std::cin>>c;
std::ifstream get;
std::ofstream temp;
get.open("Transport.text");
temp.open("temprary.text");
if(temp.is_open())
{
if(get.is_open())
{
while(!get.eof())
{
get>>name;
get>>bus_root;
get>>roll_no;
get>>card_no;
if(c != card_no)
{
temp << "\n" << name << "\t\t" << bus_root << "\t\t" << roll_no << "\t\t" << card_no ;
}
}
get.close();
temp.close();
std::remove("Transport.text");
std::rename("temprary.text","Transport.text");
}
}
std::cout<<"Delete is succesfully";
std::cout<<"\nIf you want continous press(1/0)";
int m;
std::cin>>m;
if(m==1)
{
Admin();
}
}
void show_student()
{
system("cls");
std::ifstream get;
get.open("Transport.text");
if(get.is_open())
{
std::cout<<"Name\t\tBus Root\t\tRoll No\t\t\tCard NO";
while(!get.eof())
{
get>>name;
get>>bus_root;
get>>roll_no;
get>>card_no;
std::cout << "\n" << name << "\t\t" << bus_root << "\t\t\t" << roll_no << "\t\t\t" << card_no;
}
get.close();
}
std::cout<<"\nIf you want continous press(1/0)";
int m;
std::cin>>m;
if(m==1)
{
if(ab==1)
{
Admin();
}
else
{
student();
}
}
}
void expend()
{
system("cls");
std::cout<<"\n\n\n\n\t\tPetrol bill =\t 10000\n";
std::cout<<"\n\n\t\tBus Repair =\t 15000\n";
std::cout<<"\n\n\t\tDriver Salery =\t 20000\n";
std::cout<<"\nIf you want continous press(1/0)";
int m;
std::cin>>m;
if(m==1)
{
Admin();
}
}
void reve()
{
system("cls");
int i,b;
b=45000;
i=0;
rent=2500;
system("cls");
std::ifstream get;
get.open("Transport.text");
if(get.is_open())
{
while(!get.eof())
{
get>>name;
get>>bus_root;
get>>roll_no;
get>>card_no;
i=i+1;
}
rent=rent*i;
std::cout<<"\n\n\n\n\t\tThe Total revenue is = "<<rent;
std::cout<<"\n\n\n\t\tProfit is = "<<b-rent;
get.close();
}
std::cout<<"\nIf you want continous press(1/0)";
int m;
std::cin>>m;
if(m==1)
{
Admin();
}
}
};
class Cafe
{
protected:
std::string eatables;
float price_of_eatables;
float cafe_expenditure;
float cafe_revenue;
std::string name;
int roll_no;
int ab;
int a = 10, b = 20, c = 30, d = 40, e = 40, f = 20, g = 50, h = 40, i = 30, j = 30, k = 25, l = 55, m = 45;
public:
void password()
{
std::string use;
std::string pass;
for (int i = 1; i<= 3; i++)
{
std::cout<<"\n\t\t***********************************************";
std::cout<<"\n\t\t\t\tWelcome To Cafe\n";
std::cout<<"\n\t\t***********************************************\n";
std::cout << " 1 admin\n";
std::cout << "\n 2 student\n";
int ch;
std::cin >> ch;
if (ch == 1)
{
for(int z=1;z<4;z++)
{
std::cout<<"\nEnter the Username\t:\t";
std::cin>>use;
std::cout<<"\nEnter the Password\t:\t";
std::cin>>pass;
if(use=="user"&&pass=="pass")
{
ab=1;
admin();
break;
}
else
{
std::cout<<"\n\t\tWrong Password/username";
}
}
}
if (ch == 2)
{
student();
}
else
{
std::cout << "invalid selection";
}
}
}
void student()
{
CUSTOMER_BUY();
}
void admin()
{
std::cout << "\n 1 show menu";
std::cout << "\n 2 update menu";
std::cout << "\n 3 cafe expanditiure";
std::cout << "\n 4 cafe revenue" << std::endl;
int ch;
std::cin >> ch;
if (ch == 1)
{
SHOW_CAFE_MENU();
}
else if (ch == 2)
{
UPDATE_CAFE_MENU();
}
else if (ch == 3)
{
CAFE_EXPENDITURE();
}
else if (ch == 4)
{
CAFE_REVENUE();
}
else
{
std::cout << "invalid selection";
}
}
void UPDATE_CAFE_MENU()
{
std::cout << "Coffee menu update\n";
std::cout << "Regular =";
std::cin >> a;
std::cout << "Decaf =";
std::cin >> b;
std::cout << "Americano =";
std::cin >> c;
std::cout << "Latte =";
std::cin >> d;
std::cout << "Espresso =";
std::cin >> e;
std::cout << "Cappuccino =";
std::cin >> f;
std::cout << "Macchiato =";
std::cin >> g;
std::cout << "Snacks menu update\n";
std::cout << "Plain Muffin =";
std::cin >> h;
std::cout << "Blueberry Muffin =";
std::cin >> i;
std::cout << "Raspberry Muffin =";
std::cin >> j;
std::cout << "Scone =";
std::cin >> k;
std::cout << "Blueberry Scone =";
std::cin >> l;
std::cout << "Croissant =";
std::cin >> m;
std::cout << "******Hunter Cafe CMS*******\n"; //menu display
std::cout << "Welcome! Here is the Cafe Menu:\n";
std::cout << "**Coffee* *Cost($)* *Snacks* *Cost($)**\n";
std::cout << "1) Regular " << a << " 8)Plain Muffin " << h << std::endl;
std::cout << "2) Decaf " << b << " 9)Blueberry Muffin " << i << std::endl;
std::cout << "3) Americano " << c << " 10)Raspberry Muffin " << j << std::endl;
std::cout << "4) Latte " << d << " 11)Scone " << k << std::endl;
std::cout << "5) Espresso " << e << " 12)Blueberry Scone " << l << std::endl;
std::cout << "6) Cappuccino " << f << " 13)Croissant " << m << std::endl;
std::cout << "7) Macchiato " << g << std::endl;
std::fstream file;
file.open("data.text",std::ios::app);
file << "******Hunter Cafe CMS*******\n"; //menu display
file << "Welcome! Here is the Cafe Menu:\n";
file << "**Coffee* *Cost($)* *Snacks* *Cost($)**\n";
file << "1) Regular " << a << " 8)Plain Muffin " << h << std::endl;
file << "2) Decaf " << b << " 9)Blueberry Muffin " << i << std::endl;
file << "3) Americano " << c << " 10)Raspberry Muffin " << j << std::endl;
file << "4) Latte " << d << " 11)Scone " << k << std::endl;
file << "5) Espresso " << e << " 12)Blueberry Scone " << l << std::endl;
file << "6) Cappuccino " << f << " 13)Croissant " << m << std::endl;
file << "7) Macchiato " << g << std::endl;
file.close();
char z;
std::cout << "Did you want to go the main Page(Y/N)";
std::cin >> z;
if (z == 'Y' || z == 'y')
{
admin();
}
}
void SHOW_CAFE_MENU()
{
std::ofstream file;
file.open("data.text",std::ios::app);
file << "Welcome! Here is the Cafe Menu:\n";
file << "**Coffee* *Cost($)* *Snacks* *Cost($)**\n";
file << "1) Regular " << a << " 8)Plain Muffin " << h << std::endl;
file << "2) Decaf " << b << " 9)Blueberry Muffin " << i << std::endl;
file << "3) Americano " << c << " 10)Raspberry Muffin " << j << std::endl;
file << "4) Latte " << d << " 11)Scone " << k << std::endl;
file << "5) Espresso " << e << " 12)Blueberry Scone " << l << std::endl;
file << "6) Cappuccino " << f << " 13)Croissant " << m << std::endl;
file << "7) Macchiato " << g << std::endl;
file.close();
std::cout << "******Hunter Cafe CMS*******\n"; //menu display
std::cout << "Welcome! Here is the Cafe Menu:\n";
std::cout << "**Coffee* *Cost($)* *Snacks* *Cost($)**\n";
std::cout << "1) Regular " << a << " 8)Plain Muffin " << h << std::endl;
std::cout << "2) Decaf " << b << " 9)Blueberry Muffin " << i << std::endl;
std::cout << "3) Americano " << c << " 10)Raspberry Muffin " << j << std::endl;
std::cout << "4) Latte " << d << " 11)Scone " << k << std::endl;
std::cout << "5) Espresso " << e << " 12)Blueberry Scone " << l << std::endl;
std::cout << "6) Cappuccino " << f << " 13)Croissant " << m << std::endl;
std::cout << "7) Macchiato " << g << std::endl;
char z;
std::cout << "Did you want to go the main Page(Y/N)";
std::cin >> z;
if (z == 'Y' || z == 'y')
{
admin();
}
}
void CAFE_EXPENDITURE()
{
std::cout << "\n Montly expanditure";
std::cout << "\n Biling amount = 15000";
std::cout << "\n Gas bill = 30000";
std::cout << "\n Material cost = 10000";
std::fstream obj;
obj.open("Expenditure.text", std::ios::app);
if (!obj)
{
std::cout << "\n creation failed";
}
else
{
obj << "\n Montly expanditure";
obj << "\n Biling amount = 15000";
obj << "\n Gas bill = 30000";
obj << "\n Material cost = 10000";
}
char z;
std::cout << "Did you want to go the main Page(Y/N)";
std::cin >> z;
if (z == 'Y' || z == 'y')
{
admin();
}
}
void CAFE_REVENUE()
{
cafe_revenue = 45000;
std::cout << "\n \t Total amount = 100000";
std::cout << "\n \t Spent money=55000";
std::cout << "\n \t Profit =total amount - spent money";
std::cout << "\n \t Profit = " << cafe_revenue;
std::fstream objt;
objt.open("Revenue.text");
if (!objt)
{
std::cout << "\n creation failed";
}
else {
objt << "\n \t Total amount = 100000";
objt << "\n \t Spent money=55000";
objt << "\n \t Profit =total amount - spent money";
objt << "\n \t Profit = " << cafe_revenue;
}
objt.close();
char z;
std::cout << "Did you want to go the main Page(Y/N)";
std::cin >> z;
if (z == 'Y' || z == 'y')
{
admin();
}
}
void CUSTOMER_BUY()
{
int choice; //declare variables
double q = 0;
double total = 0;
std::string input = "Y"; //default input is yes
std::string input2, input3, input4;
double array[13] = { a, b,c,d,e,f,g,h,i,j, k, l, m }; // declare array
while (input == "Y" || input == "y") // while loop when input=y
{
std::cout << "******Hunter Cafe CMS*******\n"; //menu display
std::cout << "Welcome! Here is the Cafe Menu:\n";
std::cout << "**Coffee* *Cost($)* *Snacks* *Cost($)**\n";
std::cout << "1) Regular " << a << " 8)Plain Muffin " << h << std::endl;
std::cout << "2) Decaf " << b << " 9)Blueberry Muffin " << i << std::endl;
std::cout << "3) Americano " << c << " 10)Raspberry Muffin " << j << std::endl;
std::cout << "4) Latte " << d << " 11)Scone " << k << std::endl;
std::cout << "5) Espresso " << e << " 12)Blueberry Scone " << l << std::endl;
std::cout << "6) Cappuccino " << f << " 13)Croissant " << m << std::endl;
std::cout << "7) Macchiato " << g << std::endl;
std::cout << "what would you like?(1-13):\n";
std::cin >> choice;
std::cout << "how many would you like?:\n";
std::cin >> q; //quantity
std::cout << "Would you like anything else?(Y/N):\n";
std::cin >> input;
total = (q * array[choice - 1]) + total;
if (input == "N" || input == "n")
{
std::cout << "Thank you for shopping at Hunter Cafe CMS! Have a nice day!\n";
}
}
std::fstream my_file;
my_file.open("Bill.text", std::ios::app);
switch (choice)
{
case 0:
std::cout << "invalid response";
case 1:
std::cout << "\nyou have ordered: " << q << " Regular (" << a << ")";
std::cout << "\nyour total is $ " << total;
my_file << "\nyou have ordered: " << q << " " << choice;
my_file << "\nyour total is $ " << total;
break;
case 2:
std::cout << "\nyou have ordered: " << q << "Decaf coffee (" << b << ")";
std::cout << "\nyour total is $ " << total;
my_file << "\nyou have ordered: " << q << "Decaf coffee ($" << b << ")";
my_file << "\nyour total is $ " << total;
break;
case 3:
std::cout << "\nyou have ordered: " << q << "Americano (" << c << ")";
std::cout << "\nyour total is $ " << total;
my_file << "\nyou have ordered: " << q << "Americano (" << c << ")";
my_file << "\nyour total is $ " << total;
break;
case 4:
std::cout << "\nyou have ordered: " << q << "Latte (" << d << ")";
std::cout << "\nyour total is $ " << total;
my_file << "\nyou have ordered: " << q << "Latte (" << d << ")";
my_file << "\nyour total is $ " << total;
break;
case 5:
std::cout << "\nyou have ordered: " << q << "Espresso (" << e << ")";
std::cout << "\nyour total is $ " << total;
my_file << "\nyou have ordered: " << q << "Espresso (" << e << ")";
my_file << "\nyour total is $ " << total;
break;
case 6:
std::cout << "\nyou have ordered: " << q << "Cappuccino (" << f << ")";
std::cout << "\nyour total is $ " << total;
my_file << "\nyou have ordered: " << q << "Cappuccino (" << f << ")";
my_file << "\nyour total is $ " << total;
break;
case 7:
std::cout << "\nyou have ordered: " << q << "Macchiato (" << g << ")";
std::cout << "\nyour total is $ " << total;
my_file << "\nyou have ordered: " << q << "Macchiato (" << g << ")";
my_file << "\nyour total is $ " << total;
break;
case 8:
std::cout << "\nyou have ordered: " << q << "plain Muffin (" << h << ")";
std::cout << "\nyour total is $ " << total;
my_file << "\nyou have ordered: " << q << "plain Muffin (" << h << ")";
my_file << "\nyour total is $ " << total;
break;
case 9:
std::cout << "\nyou have ordered: " << q << "Blueberry Muffin (" << i << ")";
std::cout << "\nyour total is $ " << total;
my_file << "\nyou have ordered: " << q << "Blueberry Muffin (" << i << ")";
my_file << "\nyour total is $ " << total;
break;
case 10:
std::cout << "\nyou have ordered: " << q << "Raspberry Muffin (" << j << ")";
std::cout << "\nyour total is $ " << total;
my_file << "\nyou have ordered: " << q << "Raspberry Muffin (" << j << ")";
my_file << "\nyour total is $ " << total;
break;
case 11:
std::cout << "\nyou have ordered: " << q << "Scone (" << k << ")";
std::cout << "\nyour total is $ " << total;
std::cout << "\nyou have ordered: " << q << "Scone (" << k << ")";
my_file << "\nyour total is $ " << total;
break;
case 12:
std::cout << "\nyou have ordered: " << q << "Blueberry Scone (" << l << ")";
std::cout << "\nyour total is $ " << total;
my_file << "\nyou have ordered: " << q << "Blueberry Scone (" << l << ")";
my_file << "\nyour total is $ " << total;
break;
case 13:
std::cout << "\nyou have ordered: " << q << "Croissant (" << m << ")";
std::cout << "\nyour total is $ " << total;
my_file << "\nyou have ordered: " << q << "Croissant (" << m << ")";
my_file << "\nyour total is $ " << total;
break;
}
}
};
int main()
{
int PASSWORD;
std::string NAme;
int ch;
std::cout << "\n\t\t************************************************\n";
std::cout << "\t\t WELCOME TO UNIVERSITY MANAGMENT SYSTEM\n";
std::cout << "\n\t\t************************************************\n";
std::cout << "\n\t\tENTER 1 FOR ADMIN:";
std::cout << "\n\t\tENTER 2 FOR TEACHER:";
std::cout << "\n\t\tENTER 3 FOR STUDENT:\n";
std::cout<<"\n\t\t Select Option:";
std::cin>>ch;
system("cls");
if (ch == 1 )
{
std::cout << "\n\t\t************************************************\n";
std::cout << "\t\t\t WELCOME TO ADMINISTRATOR\n";
std::cout << "\n\t\t************************************************\n";
for(int i=1;i<=3;i++)
{
std::cout<<"\n\t\tEnter Name:";
std::cin>>NAme;
std::cout<<"\n\t\tENTER PASSWORD:";
std::cin>>PASSWORD;
if(NAme=="admin" && PASSWORD==123)
{
std::cout<<"\n\tMENU FOR ADMINISTRATOR:\n";
std::cout<<"\t01. ADMISSION OFFICE\n";
std::cout<<"\t02. ACCOUNTANT\n";
std::cout<<"\t03. LIBRARAY\n";
std::cout<<"\t04. COMPUTER LAB\n";
std::cout<<"\t05. HOSTEL\n";
std::cout<<"\t06. TRANSPORT\n";
std::cout<<"\t07. CAFE\n";
std::cout<<"\t08. STUDENT-2\n";
std::cout<<"\t09. TEACHER\n";
std::cout<<"\t10. Admin\n";
std::cout<<"\t11. TEACHER ATTENDENCE\n";
std::cout<<"\t12. STUDENT ATTENDENCE\n";
std::cout<<"\t13. EMPLOYEE\n";
std::cout<<"\t14. COORDINATOR\n";
std::cout<<"\t00. EXIT:\n\n";
int sel;
std::cout<<"\tEnter the Selection:";
std::cin>>sel;
system("cls");
if(sel==1)
{
Admission_office af;
af.Admission_password();
}
if(sel==2)
{
Accountant obj;
obj.accountan_password();
}
if(sel==3)
{
library h;
h.Chief_Password();
}
if(sel==4)
{
Computer_lab l;
l.lab_password();
}
if(sel==5)
{
Hostel h;
h.Password_H();
}
if(sel==6)
{
Transport t;
t.password_t();
}
if(sel==7)
{
Cafe cc;
cc.password();
}
if(sel==8)
{
Student_2 obj1;
obj1.password();
}
if(sel==9)
{
Teacher t;
t.password();
}
if(sel==10)
{
Admin a;
a.display();
}
if(sel==11)
{
Teacher_attendence ob;
ob.display_teacher();
}
if(sel==12)
{
Student_attendence obj;
obj.display();
}
if(sel==13)
{
Employee e;
e.Display_m();
}
if(sel==14)
{
coordinator c;
c.cord_display();
}
if(sel==0)
{
exit(0);
}
else
{
std::cout<<"\tTRY AGAIN!";
}
}
break;
}}
if(ch==2)
{
std::cout << "\n\t\t************************************************\n";
std::cout << "\t\t\t WELCOME TO TEACHER DOMAIN\n";
std::cout << "\n\t\t************************************************\n";
for(int i=1;i<=3;i++)
{
std::cout<<"\n\t\tEnter Name:";
std::cin>>NAme;
std::cout<<"\n\t\tENTER PASSWORD:";
std::cin>>PASSWORD;
if(NAme=="teacher" && PASSWORD==123)
{
std::cout<<"\n\t MENU FOR TEACHER";
std::cout<<"\n\t01.STUDENT ATTENDENCE";
std::cout<<"\n\t02.CAFE";
std::cout<<"\n\t03.RESULT\n";
std::cout<<"\t04. COMPUTER LAB\n";
std::cout<<"\t00.EXIT:\n\n";
int sel;
std::cout<<"\tEnter the Selection:";
std::cin>>sel;
system("cls");
if(sel==1)
{
Student_attendence obj;
obj.display();
}
if(sel==2)
{
Cafe cc;
cc.password();
}
if(sel==3)
{
Result r;
r.menu();
}
if(sel==4)
{
Computer_lab l;
l.lab_password();
}
if(sel==0)
{
exit(0);
}
break;
}
else
{
std::cout<<"\tTRY AGAIN!";
}
}
}
if(ch==3)
{
std::cout << "\n\t\t************************************************\n";
std::cout << "\t\t\t WELCOME TO STUDENT DOMAIN\n";
std::cout << "\n\t\t************************************************\n";
for(int i=1;i<=3;i++)
{
std::cout<<"\n\t\tEnter Name:";
std::cin>>NAme;
std::cout<<"\n\t\tENTER PASSWORD:";
std::cin>>PASSWORD;
if(NAme=="student" && PASSWORD==123)
{
std::cout<<"\n\t MENU FOR STUDENT";
std::cout<<"\n\t01.STUDENT";
std::cout<<"\n\t02.Member";
std::cout<<"\n\t03.COMPUTER LAB";
std::cout<<"\n\t04.FINE";
std::cout<<"\n\t00.EXIT:\n\n";
int sel;
std::cout<<"\tEnter the Selection:";
std::cin>>sel;
system("cls");
if(sel==1)
{
Student d;
d.student_Password();
}
if(sel==2)
{
Member m;
m.Display_menu();
}
if(sel==3)
{
Computer_lab l;
l.lab_password();
}
if(sel==4)
{
fine f;
f.display();
}
if(sel==0)
{
exit(0);
}
break;
}
else
{
std::cout<<"\tTRY AGAIN!";
}
}
}
else
{
exit(0);
}
}