-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlacement_mng_sys.cpp
More file actions
352 lines (274 loc) · 8.05 KB
/
Placement_mng_sys.cpp
File metadata and controls
352 lines (274 loc) · 8.05 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
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
#include <iostream>
#include<vector>
#include <iomanip>
#include <fstream>
#include <string>
#include <conio.h>
#include <windows.h>
using namespace std;
struct student
{
string fname;
string lname;
string Registration;
float cgpa;
}studentData;
struct geeks
{
string fst_name;
string lst_name;
float c_gpa;
string Department;
float cel_no;
}tech[50];//Variable of geeks type
enum colour { DARKBLUE = 1, DARKGREEN, DARKTEAL, DARKRED, DARKPINK, DARKYELLOW, GRAY, DARKGRAY, BLUE, GREEN, TEAL, RED, PINK, YELLOW, WHITE };
struct setcolour
{
colour _c;
HANDLE _console_handle;
setcolour(colour c, HANDLE console_handle)
: _c(c), _console_handle(0)
{
_console_handle = console_handle;
}
};
basic_ostream<char> &operator<<(basic_ostream<char> &s, const setcolour &ref)
{
SetConsoleTextAttribute(ref._console_handle, ref._c);
return s;
}
int main(int argc, char *argv[])
{
HANDLE chandle = GetStdHandle(STD_OUTPUT_HANDLE);
cout<<setw(60) <<setcolour(RED,chandle)<< "WELCOME" << setcolour(GREEN,chandle) << endl;
// cin.get();
int login();
login();
int i=0,j;//for processing usage
char choice;//for getting choice
string find;//for sorting
string srch;
while(1)//outer loop
{
system("cls");//Clear screen
HANDLE chandle = GetStdHandle(STD_OUTPUT_HANDLE);
cout<<setw(60)<< setcolour(DARKYELLOW,chandle) << endl;
//Level 1-Display process
cout<<"\t\t\t\t\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\";
cout<<"\n\n\t\t\t\t\t PLACEMENT MANAGEMENT SYSTEM\n\n";
cout<<"\t\t\t\t\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\";
cout<<"\n\n\t\t\t\t\t\t:MADE BY:*VICKY*\n\n";
cout<<"\t\t\t\t\t1. Students Information"<<endl;
cout<<"\t\t\t\t\t2. GEEKS Information"<<endl;
cout<<"\t\t\t\t\t3. Exit Program"<<endl;
cout<<"\n\n\t\t\t\tEnter your choice: ";
cin>>choice;
system("cls");//Clear screen
switch(choice)//First switch
{
case '1': //Student
{
while(1)//inner loop-1
{
system("cls");//Clear screen
HANDLE chandle = GetStdHandle(STD_OUTPUT_HANDLE);
cout<<setw(60)<< setcolour(BLUE,chandle) << endl;
//Level-2 display
cout<<"\t\t\t\tSTUDENTS INFORMATION AND BIO DATA SECTION\n\n\n";
cout<<"\t\t\t\t\t1. Create new entry\n";
cout<<"\t\t\t\t\t2. Find and display entry\n";
cout<<"\t\t\t\t\t3. Jump to main\n";
cout<<"\n\n\t\t\t\tEnter your choice: ";
cin>>choice;
switch (choice)//Second switch
{
case '1'://Insert data
{ ofstream f1("student.txt",ios::app);
for( i=0;choice!='n';i++)
{
if((choice=='y')||(choice=='Y')||(choice=='1'))
{
system("CLS");
HANDLE chandle = GetStdHandle(STD_OUTPUT_HANDLE);
cout<<setw(60)<< setcolour(RED,chandle) << endl;
cout<<"\t\t\t\t\t NEW ENTRY\n\n";
cout<<"\t\t\t\t\tEnter First name: ";
cin>>studentData.fname;
cout<<"\n\t\t\t\t\tEnter Last name: ";
cin>>studentData.lname;
cout<<"\n\t\t\t\t\tEnter Registration number: ";
cin>>studentData.Registration;
cout<<"\n\t\t\t\t\tEnter cgpa: ";
cin>>studentData.cgpa;
f1<<studentData.fname<<endl<<studentData.lname<<endl<<studentData.Registration<<endl<<studentData.cgpa<<endl;
cout<<"\n\n\t\t\t\t\tDo you want to enter data: ";
cout<<"\n\t\t\t\t\tPress Y for Continue and N to Finish: ";
cin>>choice;
}
}
f1.close();
}
continue;//control back to inner loop -1
case '2'://Display data
{ ifstream f2("student.txt");
system("CLS");
HANDLE chandle = GetStdHandle(STD_OUTPUT_HANDLE);
cout<<setw(60)<< setcolour(DARKGRAY,chandle) << endl;
cout<<"\n\t\t\t\tDISPLAY STUDENT'S ENTRY\n";
cout<<"\n\t\t\t\t\tEnter First name to be displayed: ";
cin>>find;
cout<<endl;
int notFound = 0;
for( j=0;(j<i)||(!f2.eof());j++)
{
getline(f2,studentData.fname); //getline() function extracts characters from the input
if(studentData.fname==find)
{
notFound = 1;
cout<<"\n\t\t\t\t\tFirst Name: "<<studentData.fname<<endl;
cout<<"\n\t\t\t\t\tLast Name: "<<studentData.lname<<endl;
cout<<"\n\t\t\t\t\tRegistration Number: "<<studentData.Registration<<endl;
cout<<"\n\t\t\t\t\tCGPA: "<<studentData.cgpa<<endl<<endl;
}
}
if(notFound == 0){
cout<<"\n\t\t\tNo Record Found"<<endl;
}
f2.close();
cout<<"Press any key two times to proceed";
getch();//To hold data on screen
getch();//To hold data on screen
}
continue;//control back to inner loop -1
case '3'://Jump to main
{
break;//inner switch breaking
}
}
break;//inner loop-1 breaking
}
case '2':
{
while(1)//inner loop-2
{
system("cls");
HANDLE chandle = GetStdHandle(STD_OUTPUT_HANDLE);
cout<<setw(60)<< setcolour(DARKRED,chandle) << endl;
//Level-2 Display process
cout<<"\t\t\t\tINFORMATION AND BIODATA SECTION\n\n\n";
cout<<"\t\t\t\t\t1. Create new entry\n";
cout<<"\t\t\t\t\t2. Find and display\n";
cout<<"\t\t\t\t\t3. Jump to main\n";
cout<<"\n\n\t\t\t\tEnter your choice: ";
cin>>choice;
switch (choice)//Third switch
{
case '1'://Insert data
{
ofstream t1("geeks.txt",ios::app);
for(i=0;choice!='n'&& choice!='N';i++)
{
if((choice=='y')||(choice=='Y')||(choice=='1'))
{
system("CLS");
HANDLE chandle = GetStdHandle(STD_OUTPUT_HANDLE);
cout<<setw(60)<< setcolour(BLUE,chandle) << endl;
cout<<"\t\t\t\t\tEnter First name: ";
cin>>tech[i].fst_name;
cout<<"\n\t\t\t\t\tEnter Last name:: ";
cin>>tech[i].lst_name;
cout<<"\n\t\t\t\t\tEnter CGPA";
cin>>tech[i].c_gpa;
cout<<"\n\t\t\t\t\tEnter Department: ";
cin>>tech[i].Department;
cout<<"\n\t\t\t\t\tEnter Phone Number: ";
cin>>tech[i].cel_no;
t1<<tech[i].fst_name<<endl<<tech[i].lst_name<<endl<<tech[i].c_gpa<<endl<<tech[i].Department<<endl<<tech[i].cel_no<<endl;
cout<<"\n\n\t\t\t\t\tDo you want to enter data: ";
cin>>choice;
}//if
}//for loop
//for finding through name
system("cls");
t1.close();
}//case 1
continue;//Control pass to inner loop-2
case '2'://Display data
{
fstream t2("geeks.txt",ios::in|ios::binary|ios::app);
//system("CLS");
cout<<"\n\t\t\t\tDISPLAY GEEKS ENTRY\n";
cout<<"\n\t\t\t\t\tEnter name to be displayed: ";
cin>>find;
cout<<endl;
int notFound = 0;
for( j=0;((j<i)||(!t2.eof()));j++)
{
getline(t2,tech[j].fst_name); //getline is used to read a string from input stream
if(tech[j].fst_name==find)
{
notFound = 1;
cout<<"\n\t\t\t\t\tFirst name: "<<tech[j].fst_name<<endl;
getline(t2,tech[j].lst_name);
cout<<"\n\t\t\t\t\tLast name: "<<tech[j].lst_name<<endl;
//t2,tech[j].c_gpa;
t2>>tech[j].c_gpa;
cout<<"\n\t\t\t\t\tCGPA: "<<tech[j].c_gpa<<endl;
getline(t2,tech[j].Department);
cout<<"\n\t\t\t\t\tDEPARTMENT: "<<tech[j].Department<<endl;
// t2,tech[j].cel_no;
t2>>tech[j].cel_no;
cout<<"\n\t\t\t\t\tPhone Number: "<<tech[j].cel_no<<endl;
}//if
}//for loop
t2.close();
if(notFound == 0){
cout<<"\n\t\t\tNo Record Found"<<endl;
}
cout<<"Press any key two times to proceed";
}//case 2
continue;
case '3'://Jump to main
{
break;
}//case 3
}
break;
}//inner loop
continue;//control pass to 1st loop
}//outer case 2
case '3':
{
cout<<"\n MADE BY VICKY PANDEY";
break;//outer case 3
}//outer case 3
}
break;//outer loop
}
}
}
int login(){
string pass ="";
char ch;
cout<<"\n\n\n\n\n\n\n\n\t\t\t\t\tPLACEMENT MANAGEMENT SYSTEM \n\n";
cout<<"\t\t\t\t\t------------------------------";
cout<<"\n\t\t\t\t\t\t LOGIN \n";
cout<<"\t\t\t\t\t------------------------------\n\n";
cout << "\t\t\t\t\tEnter Password: ";
ch = _getch();
while(ch != 13){//character 13 is enter
pass.push_back(ch);
cout << '*';
ch = _getch();
}
if(pass == "vicky"){
cout << "\n\n\n\t\t\t\t\t\tAccess Granted! \n";
system("PAUSE");
system ("CLS");
}else{
cout << "\n\n\t\t\t\t\t\t\t\tAccess Aborted...\n\t\t\t\t\t\t\t\tPlease Try Again\n\n";
system("PAUSE");
system("CLS");
login();
}
}