-
-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathProject on Attendance Management
More file actions
161 lines (137 loc) · 2.85 KB
/
Project on Attendance Management
File metadata and controls
161 lines (137 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#include <iostream>
#include <string>
#include <fstream>
#include <cstring>
using namespace std;
int adminView();
int studentView();
int studentLogin();
int checkCredentials(string userName, string password);
int getAllStudentsbyRollNo();
int deleteAllStudents();
int deleteStudentbyRollno();
int checkListOfStudentsRegistered();
int checkPresenseCountbyRollno();
int getListOfStudentsWithTheirPresenseCount();
int registerStudent();
int adminLogin();
int registerStudent();
int markMyAttendance(string username);
int countMyAttendance(string username);
int delay();
int delay()
{
for(int i = 0; i<3; i ++)
{
cout<<"\n Saving Records ...";
for(int ii = 0; ii<20000; ii ++)
{
for(int iii = 0; iii<20000; iii ++)
{ }
}
}
cout<<"\n Exiting Now ...";
for(int i = 0; i<3; i ++){
for(int ii = 0; ii<20000; ii ++) {
for(int iii = 0; iii<20000; iii ++){
}
}
}
return 0;
}
int adminView()
{
int goBack = 0;
while(1)
{
system("cls");
cout<<"\n 1 Register a Student";
cout<<"\n 2 Delete All students name registered";
cout<<"\n 3 Delete student by rollno";
cout<<"\n 4 Check List of Student registered by userame";
cout<<"\n 5 Check presense count of any student by Roll No";
cout<<"\n 6 Get List of student with their attendance count";
cout<<"\n 0. Go Back <- \n";
int choice;
cout<<"\n Enter you choice: ";
cin>>choice;
switch(choice)
{
case 1: registerStudent();break;
case 2: deleteAllStudents(); break;
case 3: deleteStudentbyRollno(); break;
case 4: checkListOfStudentsRegistered(); break;
case 5: checkPresenseCountbyRollno(); break;
case 6: getListOfStudentsWithTheirPresenseCount(); break;
case 0: goBack = 1;break;
default: cout<<"\n Invalid choice. Enter again ";
getchar();
}
if(goBack == 1)
{
break; //break the loop
}
}
return 0;
}
int studentLogin()
{
system("cls");
cout<<"\n -------- Student Login ---------";
studentView();
delay();
return 0;
}
int adminLogin()
{
system("cls");
cout<<"\n --------- Admin Login --------";
string username;
string password;
cout<<"\n Enter username : ";
cin>>username;
cout<<"\n Enter password : ";
cin>>password;
if(username=="admin" && password=="admin@2")
{
adminView();
getchar();
delay();
}
else
{
cout<<"\n Error ! Invalid Credintials..";
cout<<"\n Press any key for main menu ";
getchar();getchar();
}
return 0;
}
int checkStudentCredentials(string username, string password)
{
// read file line by line & check if username-password.dat exist?
// if it exsist return 1 else 0
ifstream read;
read.open("db.dat");
if (read) {
// The file exists, and is open for input
int recordFound = 0;
string line;
string temp = username + password + ".dat";
cout<<"\n file name is : "<<temp;
while(getline(read, line)) {
if(line == temp)
{
recordFound = 1;
break;
}
}
if(recordFound == 0)
return 0;
else
return 1;
}
else
{
return 0;
}
}