#include<iostream>
#include<fstream>
using namespace std;
const string pass="superior";
class admin
{
private:
int d;
int
roll;
int
password;
string
name;
int
age;
string
edu;
int
fee;
int
sub;
int
id;
int
sal;
string
cal;
int
m,q,f;
private:
void write_tea()
{
cout<<"enter
teacher id : "<<'\n';
cin>>id;
cout<<"enter
teacher password : "<<'\n';
cin>>password;
cout<<"enter
teacher name : "<<'\n';
cin>>name;
cout<<"enter
teacher age : "<<'\n';
cin>>age;
cout<<"enter
teacher education : "<<'\n';
cin>>edu;
cout<<"enter
teacher salary : "<<'\n';
cin>>sal;
cout<<"assigning
1 subject teacher: "<<'\n';
cin>>cal;
cout<<"how
many quiz and assignments should a teacher take"<<'\n';
cin>>q;
cin.ignore();
ofstream
fout;
fout.open("teacher_rec1.txt",ios::out
| ios::app);
fout<<endl<<id<<"
"<<password<<" "<<name<<"
"<<age<<" "<<edu<<"
"<<sal<<" "<<cal<<" "<<q;
fout.close();
}
void find_teacher_rec()
{
cout<<"
>>>>>>>>>>>>>>>>>>>>>>>>>FIND
TEACHER RECORD<<<<<<<<<<<<<<<<<<<<<<<<<< \n";
int a,count=0,tpass;
cout<<"enter
the id of teacher you want to search"<<endl;
cin>>a;
cout<<"password\n";
cin>>tpass;
ifstream
fin;
fin.open("teacher_rec1.txt");
while(!fin.eof())
{
// fout<<endl<<id<<"
"<<name<<" "<<age<<"
"<<edu<<" "<<sal<<"
"<<cal<<" "<<reli;
fin>>id>>password>>name>>age>>edu>>sal>>cal>>q;
if(a==id
&& tpass==password)
{
cout<<"id
: "<<id<<'\n'<<"name :
"<<name<<'\n'<<"age:
"<<age<<'\n'<<"edu :
"<<edu<<'\n'<<"salary :
"<<sal<<'\n'<<"classes :
"<<cal<<endl;
count++;
}
}
fin.close();
if(count==0)
{
cout<<"data not found"<<endl;
}
}
void teacheratt()
{
cout<<"
>>>>>>>>>>>>>>>>>>>>TEACHER
ATTENDANCE<<<<<<<<<<<<<<<<<<< \n";
string date,day,time;
cout<<"enter
date ";
cin>>date;
cout<<"enter
day ";
cin>>day;
cout<<"enter
time ";
cin>>time;
ifstream fin;
fin.open("teacher_rec1.txt");
while(!fin.eof())
{
fin>>id>>password>>name>>age>>edu>>sal>>cal>>q;
cout<<id<<" "<<name<<"
"<<"P"<<"
"<<"A"<<endl;
char
ch;
cout<<"[1].Present\n[2].Absent\n";
cin>>ch;
ofstream
fout;
fout.open("teacher_atten1.txt",ios::app);
fout<<endl<<date<<"
"<<day<<" "<<time<<"
"<<id<<" "<<name<<"
"<<ch;
fout.close();
}
fin.close();
}
void
check_tea_att()
{
string
date,day,time;
char
ch;
int
i,count=0;
cout<<" **********************CHECKING TEACHER ATTENDANCE******************* "<<endl;
cout<<"enter
the id you want to search "<<endl;
cin>>i;
ifstream
fin;
fin.open("teacher_atten1.txt");
while(!fin.eof())
{
fin>>date>>day>>time>>id>>name>>ch;
if(i==id)
{
cout<<"date
: "<<date<<"/";
cout<<day<<"/";
cout<<'\t'<<'\t'<<"time
: "<<time<<'\n';
cout<<"id
: "<<id<<'\t';
cout<<"name
: "<<name<<"
"<<ch<<'\n';
count++;
}
}
if(count==0)
{
cout<<"id
not fount in the record"<<endl;
}
fin.close();
}
void del_tec()
{
cout<<"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>DELETING
TEACHER RECORD<<<<<<<<<<<<<<<<<<<<<<<<<<< \n";
int d;
cout<<"enter the id you want to delete"<<'\n';
cin>>d;
ifstream fin;
fin.open("teacher_rec1.txt");
while(!fin.eof())
{
fin>>id>>password>>name>>age>>edu>>sal>>cal>>q;
ofstream
fout;
fout.open("teacher.txt",ios::app);
if(d==id)
{
fout<<"
";
}
else
{
fout<<endl<<id<<"
"<<password<<" "<<name<<"
"<<age<<" "<<edu<<"
"<<sal<<" "<<cal<<" "<<q;
}
fout.close();
}
fin.close();
remove("teacher_rec1.txt");
rename("teacher.txt","teacher_rec1.txt");
}
void write_stu()
{
cout<<"enter
student id : "<<'\n';
cin>>roll;
cout<<"enter
your password : "<<'\n';
cin>>password;
cout<<"enter
student name : "<<'\n';
cin>>name;
cout<<"enter
student age : "<<'\n';
cin>>age;
cout<<"enter
student course: "<<'\n';
cin>>edu;
cout<<"enter
student fee : "<<'\n';
cin>>fee;
cout<<"enter
no. of subjects student is studying : "<<'\n';
cin>>sub;
ofstream
fout;
fout.open("student_rec2.txt",ios::out
| ios::app);
fout<<endl<<roll<<"
"<<password<<" "<<name<<"
"<<age<<" "<<edu<<"
"<<fee<<" "<<sub;
fout.close();
}
void find_student_rec()
{
cout<<"
>>>>>>>>>>>>>>>>>>>>>>>>>>>FIND
STUDENT
RECORD<<<<<<<<<<<<<<<<<<<<<<<<< \n";
int a,count=0,spass;
//fout<<endl<<roll<<"
"<<name<<" "<<age<<" "<<edu<<"
"<<fee<<" "<<sub<<"
"<<reli;
cout<<"enter
the roll no of student you want to search"<<endl;
cin>>a;
cout<<"password\n";
cin>>spass;
ifstream
fin;
fin.open("student_rec2.txt");
while(!fin.eof())
{
fin>>roll>>password>>name>>age>>edu>>fee>>sub;
if(a==roll
&& spass==password)
{
cout<<"Roll
No. "<<roll<<'\n'<<"name
"<<name<<'\n'<<"age
"<<age<<'\n'<<"edu
"<<edu<<'\n'<<"fee
"<<fee<<'\n'<<"subject
"<<sub<<endl;
count++;
}
}
fin.close();
if(count==0)
{
cout<<"data
not found"<<'\n';
}
}
void feeing()
{
cout<<"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>STUDENT
FEE
SUBMISSION<<<<<<<<<<<<<<<<<<<<<<<<<<<<< \n";
int
no,f,afee;
cout<<"enter
your roll no of which you want to pay fee";
cin>>no;
ifstream
fin;
fin.open("student_rec2.txt");
ofstream
fout;
fout.open("student.txt",ios::app);
while(!fin.eof())
{
fin>>roll>>password>>name>>age>>edu>>fee>>sub;
if(no==roll)
{
//cout<<"fee
"<<fee[i];
afee=fee;
}
cout<<"fee
"<<afee<<endl;
cout<<"enter
the amount you want to pay"<<'\n';
cin>>f;
afee= afee-f;
fin>>roll>>password>>name>>age>>edu>>fee>>sub;
if(no==roll)
{
fout<<endl<<roll<<"
"<<name<<" "<<age<<"
"<<edu<<" "<<afee<<"
"<<sub;
}
else
fout<<endl<<roll<<"
"<<name<<" "<<age<<"
"<<edu<<" "<<fee<<"
"<<sub;
fout.close();
cout<<"your fee
submited\n";
if(afee==0)
{
cout<<"zero
charges reamining \n";
break;
}
else
if(afee>0)
{
cout<<"your
reaming fee is "<<afee<<'\n';
break;
}
}
fin.close();
remove("student_rec2.txt");
rename("student.txt","student_rec2.txt");
}
void del_stu()
{
int
d;
cout<<"
>>>>>>>>>>>>>>>>>>>>>>>>>>DELETING
STUDENT
RECORD<<<<<<<<<<<<<<<<<<<<<< \n";
cout<<"enter the id you want to delete"<<'\n';
cin>>d;
ifstream fin;
fin.open("student_rec2.txt");
while(!fin.eof())
{
fin>>roll>>password>>name>>age>>edu>>fee>>sub;
ofstream fout;
fout.open("student.txt",ios::app);
if(d==roll
)
{
fout<<"
";
}
else
{
fout<<endl<<roll<<"
"<<password<<" "<<name<<"
"<<age<<" "<<edu<<"
"<<fee<<" "<<sub;
}
fout.close();
}
fin.close();
remove("student_rec2.txt");
rename("student.txt","student_rec2.txt");
}
void
student_att()
{
cout<<" >>>>>>>>>>>>>>>>>>>>>>>>>>>>>STUDENT
ATTENDANCE<<<<<<<<<<<<<<<<<<<<<<<< \n";
string
date,day,time;
cout<<"enter
date ";
cin>>date;
cout<<"enter
day ";
cin>>day;
cout<<"enter
time ";
cin>>time;
ifstream fin;
fin.open("student_rec2.txt");
while(!fin.eof())
{
// fout<<endl<<id<<"
"<<name<<" "<<age<<"
"<<edu<<" "<<sal<<"
"<<cal<<" "<<reli;
fin>>roll>>password>>name>>age>>edu>>fee>>sub;
cout<<roll<<" "<<name<<"
"<<"P"<<"
"<<"A"<<endl;
char
ch;
cout<<"[1].Present\n[2].Absent\n";
cin>>ch;
ofstream
fout;
fout.open("student_atten2.txt",ios::app);
fout<<endl<<date<<"
"<<day<<" "<<time<<"
"<<roll<<" "<<name<<"
"<<ch;
fout.close();
}
fin.close();
}
void
check_stu_att()
{
string
date,day,time;
char
ch;
int
i,count=0;
cout<<" **********************CHECKING STUDENT
ATTENDANCE*******************
"<<endl;
cout<<"enter
ur roll NO. of student if u want to check attendence "<<endl;
cin>>i;
ifstream
fin;
fin.open("student_atten2.txt");
while(!fin.eof())
{
fin>>date>>day>>time>>roll>>name>>ch;
if(i==roll)
{
cout<<"date :
"<<date<<"/";
cout<<day<<"/";
cout<<'\t'<<'\t'<<"time
: "<<time<<'\n';
cout<<"roll
no. : "<<roll<<'\t';
cout<<"name
: "<<name<<" "<<ch<<'\n';
count++;
}
}
fin.close();
if(count==0)
{
cout<<"the
student not found in record "<<endl;
}
}
void
quiz()
{
cout<<">>>>>>>>>>>>>>>>>>>>>>>>>**********<<<<<<<<<<<<<<<<<<<<<<<<<<\n";
cout<<">>>>>>>>>>>>>>>>>>>>>>>>> Marks
<<<<<<<<<<<<<<<<<<<<<<<<<<\n";
cout<<">>>>>>>>>>>>>>>>>>>>>>>>>**********<<<<<<<<<<<<<<<<<<<<<<<<<<\n";
int
a,count=0,tpass,t[100],sum=0,s=0,avg,i;string b[100];
cout<<"Enter
ur id first...so u can ener
marks"<<endl;
cin>>a;
ifstream
fin;
fin.open("teacher_rec1.txt");
while(!fin.eof())
{
// fout<<endl<<id<<"
"<<name<<" "<<age<<"
"<<edu<<" "<<sal<<"
"<<cal<<" "<<reli;
fin>>id>>password>>name>>age>>edu>>sal>>cal>>q;
if(a==id)
{
cout<<"ID of teacher = "<<id<<endl;
cout<<"subject
that a teacher is assigned= "<<cal<<endl;
cout<<"Name = "<<name<<endl;
cout<<"roll no. of
stuent"<<endl;
cin>>i;
for
(int i=0;i<q;i++)
{
int
t;
cout<<"enter
quiz marks"<<i+1<<endl;
cin>>t;
cout<<"enter assignment marks"<<i+1<<endl;
cin>>a;
s=s+a;
sum=sum+t;
avg=sum/q;
}
cout<<"subject
"<<"sum quiz marks ="<<sum<<endl;
cout<<"subject
"<<"average quiz marks="<<avg<<endl;
cout<<"assignment summed
marks"<<s<<endl;
int
m,f;
cout<<"Mid
Marks of Subject "<<" ";
cin>>m;
cout<<"Final
Marks of Subject "<<" ";
cin>>f;
count
++;
ofstream
out;
out.open("quiz.txt",ios::out|ios::app);
out<<endl<<cal<<"
"<<" "<<i<<"
"<<q<<" "<<sum<<"
"<<avg<<" "<<s<<"
"<<m<<" "<<f;
out.close();
}
}
fin.close();
if(count==0)
{
cout<<"Data not
found"<<endl;
}
}
void check_quiz()
{
int
count=0;
ifstream
n;
n.open("student_rec2.txt");
while(!n.eof())
{
int
r,sum,s,avg,i,count=0;
n>>roll>>password>>name>>age>>edu>>fee>>sub;
cout<<"eneter
ur roll no\n";
cin>>r;
if(r==roll)
{
ifstream fin;
fin.open("quiz.txt");
while(!fin.eof())
{
// out<<endl<<cal<<"
"<<" "<<i<<"
"<<q<<" "<<sum<<"
"<<avg<<" "<<m<<" "<<f;
fin>>cal>>i>>q>>sum>>avg>>s>>m>>f;
cout<<"subject:"<<cal<<endl;;
cout<<"no. of
quizes:"<<q<<endl;
cout<<"sum of
quizes"<<sum<<endl;
cout<<"average no.of
quizes"<<avg<<endl;
cout<<"sum of assignment
marks"<<s<<endl;
cout<<"mid
marks"<<m<<endl;
cout<<"finl
marks"<<f<<endl;
count++;
}
fin.close();
if(count==0)
{
cout<<"Data not
found"<<endl;
}
}
count++;
}
n.close();
}
void main_menu()
{
int
op;
cout<<"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>ADMIN
PORTION<<<<<<<<<<<<<<<<<<<<<<<< "<<endl;
cout<<"\n";
cout<<"[1].Add
Teacher\n[2].Teacher Record\n[3].Teacher Attendance\n[4].Teacher Deletinng
Data\n[5].Add Student\n[6].Student Deleting Data\n[7].Student Fee
Submission\n[8].Exit"<<'\n';
cout<<"Select
your option"<<endl;
cout<<"____________________________________________________________________________________________________________________"<<endl;
cin>>op;
switch(op)
{
case
1:
{
system("cls");
write_tea();
system("pause");
system("cls");
main_menu();
break;
}
case
2:
{
system("cls");
find_teacher_rec();
system("pause");
system("cls");
main_menu();
break;
}
case
3:
{
system("cls");
teacheratt();
system("pause");
system("cls");
main_menu();
break;
}
case
4:
{
system("cls");
del_tec();
system("pause");
system("cls");
main_menu();
break;
}
case
5:
{
system("cls");
write_stu();
system("pause");
system("cls");
main_menu();
break;
}
case
6:
{
system("cls");
del_stu();
system("pause");
system("cls");
main_menu();
break;
}
case
7:
{
system("cls");
feeing();
system("pause");
system("cls");
main_menu();
break;
}
case
8:
{
break;;
}
}
}
friend class checking;
};
class checking
{
public:
void login(admin a)
{
int
op;
string
upass,fpass;
b:
cout<<"
>>>>>>>>>>>>>>>>>>>>>>>>>>>>PORTAL
MANAGEMENT SYSTEM<<<<<<<<<<<<<<<<<<<<<<<< "<<endl;
cout<<"select
your option\n";
cout<<"[1].
Admin login"<<'\n';
cout<<"[2].
Teacher login"<<'\n';
cout<<"[3].
Student login"<<'\n';
cout<<"____________________________________________________________________________________________________________________"<<endl;
cin>>op;
if(op==1)
{
string upass;
system("cls");
cout<<" <<<<<<admin
portion>>>>>>>>>
"<<endl;
a:
cout<<"enter
password : ";
cin>>upass;
if(upass==pass)
{
cout<<" <<<<<password
matched>>>>>\n";
a.main_menu();
}
else
{ system("cls");
cout<<"\t\t\t\t....warning!!!!....\n\t\t\t\t....wrong
password!....\n\t\t\t\t......try again......"<<endl;
goto
a;
system("pause");
system("cls");
}
system("pause");
system("cls");
goto
b;
}
if(op==2)
{
int
o;
c:
system("cls");
cout<<"
<<<<<<<<<<<teacher
portion>>>>>>>>>>>>>>>>>>> "<<endl;
cout<<"\n";
cout<<"select
your option\n";
cout<<"[1].checking
info\n[2].checking attendance\n[3].student attendane\n[4].student
quiz\n[5].back to menu\n";
cout<<"____________________________________________________________________________________________________________________"<<endl;
cin>>o;
switch(o)
{
case
1:
{
system("cls");
cout<<"your
info\n";
a.find_teacher_rec();
system("pause");
system("cls");
goto
c;
}
case 2:
{
system("cls");
cout<<"your
attendance"<<endl;
a.check_tea_att();
system("pause");
system("cls");
goto
c;
}
case
3:
{
system("cls");
cout<<"student
att\n";
a.student_att();
system("pause");
system("cls");
goto
c;
}
case
4:
{
system("cls");
cout<<"student
quiz\n";
a.quiz();
system("pause");
system("cls");
goto
c;
}
case
5:
{
system("cls");
goto b;
system("pause");
system("cls");
}
}
system("pause");
system("cls");
}
if(op==3)
{
int
s;
d:
system("cls");
cout<<"
<<<<<<<<<<<student
portion>>>>>>>>>>>>>>>>>>> "<<endl;
cout<<"\n";
cout<<"select
your option\n";
cout<<"[1].checking
info\n[2].checking attendance\n[3].checking marks\n[4].back to menu\n";
cout<<"____________________________________________________________________________________________________________________"<<endl;
cin>>s;
switch(s)
{
case
1:
{
system("cls");
cout<<"your
info"<<endl;
a.find_student_rec();
system("pause");
system("cls");
goto
d;
}
case 2:
{
system("cls");
a.check_stu_att();
system("pause");
system("cls");
goto d;
}
case 3:
{
system("cls");
a.check_quiz();
system("pause");
system("cls");
goto d;
}
case 4:
{
system("cls");
goto b;
system("pause");
system("cls");
}
}
system("pause");
system("cls");
}
else
system("cls");
{
cout<<"enter
no. between 1 to 3\n";
goto
b;
}
}};
int main()
{
admin
obj;
checking
w;
w.login(obj);
return
0;
}
0 Comments