-
Notifications
You must be signed in to change notification settings - Fork 0
/
inAdPro.cpp
244 lines (231 loc) · 5.9 KB
/
inAdPro.cpp
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
#include<iostream>
#include<string>
#include<algorithm>
#include<fstream>
#include<cstdio>
using namespace std;
class student
{
public:
void newUser();
void oldUser();
void admin();
void createdadmin();
void adminInterface();
void userInterface();
};
void student::newUser()
{
cout<<"NOTE:File name must me same as your college registration number via roll-number!"<<endl;
string fileName;
string fname;
string lname;
string surname;
int age;
float tel,hin,eng,math,sci,soc,total,percentage;
cout<<"Enter filename:";
cin>>fileName;
ofstream file;
file.open(fileName+".txt");
cout<<"Enter the first name :";
cin>>fname;
cout<<"Enter the last name :";
cin>>lname;
cout<<"Enter the surname :";
cin>>surname;
cout<<"Enter the age :";
cin>>age;
cout<<"Telugu :";
cin>>tel;
cout<<"Hindi :";
cin>>hin;
cout<<"English :";
cin>>eng;
cout<<"Maths :";
cin>>math;
cout<<"Science :";
cin>>sci;
cout<<"Social :";
cin>>soc;
total=tel+hin+eng+math+sci+soc;
percentage=(total/600)*100;
file<<fname<<endl;
file<<lname<<endl;
file<<surname<<endl;
file<<age<<endl;
file<<tel<<endl;
file<<hin<<endl;
file<<eng<<endl;
file<<math<<endl;
file<<sci<<endl;
file<<soc<<endl;
file<<total<<endl;
file<<percentage<<endl;
file.close();
cout<<"Successfully created!!!!"<<endl;
userInterface();
};
void student::oldUser()
{
cout<<"NOTE:File name must me same as your college registration number via roll-number!"<<endl;
string fileName;
string fname;
string lname;
string surname;
int age;
float tel,hin,eng,math,sci,soc,total,percentage;
cout<<"Enter filename:";
cin>>fileName;
ifstream file;
file.open(fileName+".txt");
file>>fname>>lname>>surname>>age>>tel>>hin>>eng>>math>>sci>>soc>>total>>percentage;
cout<<"NAME :"<<fname<<" "<<lname<<" "<<surname<<endl;
cout<<"AGE :"<<age<<"years"<<endl;
cout<<"MARK -- LIST"<<endl;
cout<<"Telugu :"<<tel<<endl;
cout<<"Hindi :"<<hin<<endl;
cout<<"English :"<<eng<<endl;
cout<<"Maths :"<<math<<endl;
cout<<"Science :"<<sci<<endl;
cout<<"Social :"<<soc<<endl;
cout<<"TOTAL MARKS :"<<total<<" marks"<<endl;
cout<<"PERCENTAGE :"<<percentage<<" %"<<endl;
file.close();
userInterface();
};
void student::admin()
{
string adminUsername;
int passcode;
cout<<"ADMIN loading....."<<endl;
cout<<"Enter Username :"<<endl;
cin>>adminUsername;
cout<<"Enter password :"<<endl;
cin>>passcode;
ofstream file(adminUsername+".txt");
file<<passcode;
};
void student::createdadmin()
{
string adminUsername;
int passcode;
int x;
cout<<"ADMIN loading....."<<endl;
cout<<"Enter username:";
cin>>adminUsername;
ifstream file(adminUsername+".txt");
file>>passcode;
cout<<"Enter password:";
cin>>x;
//cout<<passcode<<endl;
if(x==passcode)
{
int i;
cout<<"success"<<endl;
cout<<"<><><><><><>REGISTRATION-PANEL<><><><><><><>"<<endl;
cout<<"<><><><> 1.New student <><><><><>"<<endl;
cout<<"<><><><><><>RECORDS-PANEL<><><><><><><>"<<endl;
cout<<"<><><><> 2.Student data <><><><><>"<<endl;
cout<<"<><><><><><><><> 3.EXIT <><><><><><><><><>"<<endl;
cout<<"Enter the choice:";
cin>>i;
switch(i)
{
case 1:
newUser();
adminInterface();
break;
case 2:
oldUser();
adminInterface();
break;
case 3:
exit;
break;
default:
cout<<"Invalid "<<endl;
};
}
else
{
cout<<"\nThe username and password MIS-MATCH :(\n\n";
}
};
void student::adminInterface()
{
int i;
cout<<"<><><>1.For New-Admin creation <><><>"<<endl;
cout<<"<><><>2.For Admin Login <><><>"<<endl;
cout<<"<><><>3.EXIT<><><><>"<<endl;
cout<<"\n\n<><><><><><><><><><><><><><><><><><><><><><><><><>\n"<<endl;
cout<<"Enter the option:";
cin>>i;
switch(i)
{
case 1:
admin();
break;
case 2:
createdadmin();
break;
case 3:
exit;
break;
default:
cout<<"Invalid choice"<<endl;
break;
};
};
void student::userInterface()
{
int i;
cout<<"<><><>1.For New-user creation <><><>"<<endl;
cout<<"<><><>2.For user-data records <><><>"<<endl;
cout<<"<><><>3.EXIT<><><><>"<<endl;
cout<<"\n\n<><><><><><><><><><><><><><><><><><><><><><><><><>\n"<<endl;
cout<<"Enter the option:";
cin>>i;
switch(i)
{
case 1:
newUser();
break;
case 2:
oldUser();
break;
case 3:
exit;
break;
default:
cout<<"Invalid choice"<<endl;
break;
};
};
int main()
{
system("cls");
int i;
cout<<"<><><><><><>CREDENTIAL-PANEL<><><><><><><>"<<endl;
cout<<"<><><><> 1.USER PANAL <><><><><>"<<endl;
cout<<"<><><><> 2.ADMIN PANAL <><><><><>"<<endl;
cout<<"<><><><><><><><><><><><><><><><><><><><><><>"<<endl;
cout<<"\n<><><><><><><><><><> WELCOME <><><><><><><><><><>\n"<<endl;
cout<<"Enter the options:";
cin>>i;
switch(i)
{
case 1:
student newer;
newer.userInterface();
break;
case 2:
student admin;
newer.adminInterface();
break;
default:
cout<<"Invalid choice"<<endl;
break;
};
// cout<<INTMAX_MAX<<endl;
// cout<<INTMAX_MIN<<endl;
};