-
Notifications
You must be signed in to change notification settings - Fork 0
/
52NikhilSRMSproject.cpp
416 lines (396 loc) · 11.9 KB
/
52NikhilSRMSproject.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
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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
#include <iostream>
#include<fstream>
#include<windows.h>
using namespace std;
struct student
{
char name[90];
char id[90];
int roll_no;
float prog_m,arch_m,writing_sk,alg_m,sum,average;
};
void intro();
void mainmenu();
void acceptdata();
void view_Specific(int);
void viewall();
void result(int);
void deleterecord(int);
void modify(int);
int main()
{
system("color a");
char c;
system("cls");
intro();
do{
system("cls");
system("color e");
cout<<"\n\n";
cout<<"\t*********STUDENT REPORT CARD MANEGEMENT SYSTEM*********"<<endl;
cout<<endl;
cout<<"\t\t\t\t1. MAIN MENU\n\n";
cout<<"\t\t\t\t2. EXIT\n\n";
cout<<"ENTER YOUR CHOICE :";
cin>>c;
system("cls");
switch(c)
{
case '1':
{
mainmenu();
break;
}
}
}while(c!='2');
return 0;
}
void acceptdata()
{
system("cls");
student s;
ofstream outfile;
outfile.open("Report.txt",ios::app|ios::binary);
if(outfile.fail())
{
cout<<"THE FILE COULD NOT BE OPEN...press enter key";
cin.ignore();
cin.get();
}
cout<<"\n\n";
cout<<"\t\t\t\t=======CREATE A REPORT CARD========\n\n";
cout<<"ENTER YOUR FULL NAME :";
cin.ignore();
cin.getline(s.name,80);
cout<<"ENTER YOUR ID NUMBER : ";
cin.ignore();
cin.get(s.id,80);
cout<<"ENTER YOUR ROLL NUMBER :";
cin>>s.roll_no;
cout<<"ENTER YOUR PROGRAMMING MARK :";
cin>>s.prog_m;
cout<<"ENTER YOUR COMPUTER ARCITECTURE MARK :";
cin>>s.arch_m;
cout<<"ENTER YOUR WRITING SKILL MARK :";
cin>>s.writing_sk;
cout<<"ENTER YOUR ALGEBRA MARK :";
cin>>s.alg_m;
s.sum=s.prog_m+s.arch_m+s.writing_sk+s.alg_m;
s.average=(s.sum/4);
outfile.write(reinterpret_cast<char *> (&s), sizeof(student));
outfile.close();
cout<<endl;
cout<<"\t\t\t\tTHE FILE IS SUCCESSFULLY SAVED"<<endl;
cout<<endl;
cout<<"press any key to continue...";
cin.ignore();
cin.get();
}
void intro()
{
cout << "\n\n\n";
Sleep(300);
cout << "\t\t\t\t * * * **** * **** *** *** **** " << endl;
Sleep(300);
cout << "\t\t\t\t * * * * * * * * * * * * "<< endl;
Sleep(300);
cout << "\t\t\t\t * * * ***** * * * * * * * ***** " << endl;
Sleep(300);
cout << "\t\t\t\t * * * * * * * * * * * * " << endl;
Sleep(300);
cout << "\t\t\t\t *** **** ***** **** *** * * * **** " << endl;
Sleep(300);
cout<<endl;
cout<<"\t\t\t\t============================================="<<endl;
Sleep(500);
cout<<"\t\t\t\tTHIS IS STUDENT REPORT CARD MANEGEMENT SYSTEM \n \t\t\t\t Made By Nikhil (52), Btech It 2nd Year "<<endl;
Sleep(500);
cout<<"\t\t\t\t============================================="<<endl;
Sleep(500);
cout<<"press any key to continue...";
cin.ignore();
cin.get();
}
void mainmenu()
{
system("color c");
char cc;
cout<<"\t\t\t\t=================MAIN MENU================\n\n"<<endl;
Sleep(300);
cout<<"\t\t\t\t1. CREATE STUDENT REPORT CARD\n\n"<<endl;
Sleep(300);
cout<<"\t\t\t\t2. VIEW ALL STUDENTS REPORT CARD\n\n"<<endl;
Sleep(300);
cout<<"\t\t\t\t3. VIEW A SINGLE STUDENT REPORT CARD\n\n"<<endl;
Sleep(300);
cout<<"\t\t\t\t4. MODIFY REPORT CARD\n\n"<<endl;
Sleep(300);
cout<<"\t\t\t\t5. RESULT\n\n"<<endl;
Sleep(300);
cout<<"\t\t\t\t6. DELETE RECORD\n\n"<<endl;
Sleep(300);
cout<<"\t\t\t\t=============================="<<endl;
Sleep(300);
cout<<"\t\t\t\tENTER YOUR CHOICE...:) <1-6> :";
Sleep(300);
cin>>cc;
cout<<endl;
switch(cc)
{
case '1':
{
acceptdata();
break;
}
case '2':
{
viewall();
break;
}
case '3':
{
int n;
cout<<"ENTER YOUR ROLL NUMBER :";
cin>>n;
view_Specific(n);
break;
}
case '4':
{
int n;
cout<<"ENTER YOUR ROLL NUMBER :";
cin>>n;
modify(n);
break;
}
case '5':
{
int n;
cout<<"ENTER YOUR ROLL NUMBER :";
cin>>n;
cout<<endl;
result(n);
break;
}
case '6':
{
int n;
cout<<"ENTER YOUR ROLL NUMBER :";
cin>>n;
cout<<endl;
deleterecord(n);
break;
}
}
}
void viewall()
{
system("cls");
student s;
ifstream infile;
bool check=false;
infile.open("Report.txt",ios::app|ios::binary);
if(infile.fail())
{
cout<<"THE FILE COULD NOT BE OPENED.....press enter key...";
cin.ignore();
cin.get();
}
cout<<"\n\n";
cout<<"\t\t\t\tALL STUDENTS REPORT CARDS"<<endl;
cout<<"=================================================================================="<<endl;
while(infile.read(reinterpret_cast<char*>(&s),sizeof(student)))
{
cout<<"\t\t\t\tSTUDENT NAME :"<<s.name<<endl<<endl;
cout<<"\t\t\t\tSTUDENT ID NUMBER :"<<s.id<<endl<<endl;
cout<<"\t\t\t\tSTUDENT ROLL NUMBER :"<<s.roll_no<<endl<<endl;
cout<<"\t\t\t\tPROGRAMMING MARK :"<<s.prog_m<<endl<<endl;
cout<<"\t\t\t\tCOMPUTER ARCITECTURE MARK :"<<s.arch_m<<endl<<endl;
cout<<"\t\t\t\tWRITING SKILL MARK :"<<s.writing_sk<<endl<<endl;
cout<<"\t\t\t\tALGEBRA MARK :"<<s.alg_m<<endl<<endl;
cout<<"\t\t\t\tSUM :"<<s.sum<<endl<<endl;
cout<<"\t\t\t\tAVERAGE :"<<s.average<<endl<<endl;
cout<<"=================================================================================="<<endl;
check=true;
}
infile.close();
if(check==false)
cout<<"\t\t\t\tNO RECORD FOUND..."<<endl<<endl;
cout<<"press any key to continue....";
cin.ignore();
cin.get();
}
void view_Specific(int n)
{
system("cls");
student s;
ifstream infile;
infile.open("Report.txt",ios::app|ios::binary);
if(infile.fail())
{
cout<<"THE FILE COULD NOT BE OPENED...";
cin.ignore();
cin.get();
}
bool equality=false;
cout<<"\t\t\t\t==========VIEW A SINGLE STUDENT REPORT==========\n\n";
while(infile.read(reinterpret_cast<char*>(&s),sizeof(student)))
{
if(s.roll_no==n)
{
cout<<"\t\t\t\tSTUDENT NAME :"<<s.name<<endl;
cout<<"\t\t\t\tSTUDENT ID NUMBER :"<<s.id<<endl;
cout<<"\t\t\t\tSTUDENT ROLL NUMBER :"<<s.roll_no<<endl;
cout<<"\t\t\t\tPROGRAMMING MARK :"<<s.prog_m<<endl;
cout<<"\t\t\t\tCOMPUTER ARCITECTURE MARK :"<<s.arch_m<<endl;
cout<<"\t\t\t\tWRITING SKILL MARK :"<<s.writing_sk<<endl;
cout<<"\t\t\t\tALGEBRA MARK :"<<s.alg_m<<endl;
cout<<"\t\t\t\tSUM :"<<s.sum<<endl;
cout<<"\t\t\t\tAVERAGE :"<<s.average<<endl;
cout<<"\t\t\t\t================================================"<<endl;
equality=true;
}
}
infile.close();
if(equality==false)
cout<<"\t\t\t\tRECORD NOT FOUND..."<<endl;
cout<<endl;
cout<<"press any key to continue...";
cin.ignore();
cin.get();
}
void result(int n)
{
system("cls");
student s;
ifstream infile;
infile.open("Report.txt",ios::app|ios::binary);
if(infile.fail())
{
cout<<"THE FILE COULD NOT BE OPENED..."<<endl;
cin.ignore();
cin.get();
}
bool eq=false;
cout<<"\t\t\t\t===========VIEW A SINGLE STUDENT RESULT==========\n\n";
while(infile.read(reinterpret_cast<char*>(&s),sizeof(student)))
{
if(s.roll_no==n)
{
cout<<"\t\t\t\tSTUDENT NAME :"<<s.name<<endl<<endl;
cout<<"\t\t\t\tPROGRAMMING MARK :"<<s.prog_m<<endl<<endl;
cout<<"\t\t\t\tCOMPUTER ARCITECTURE MARK :"<<s.arch_m<<endl<<endl;
cout<<"\t\t\t\tWRITING SKILL MARK :"<<s.writing_sk<<endl<<endl;
cout<<"\t\t\t\tALGEBRA MARK :"<<s.alg_m<<endl<<endl;
cout<<"\t\t\t\tSUM :"<<s.sum<<endl<<endl;
cout<<"\t\t\t\tAVERAGE :"<<s.average<<endl<<endl;
cout<<"\t\t\t\t=================================================="<<endl;
eq=true;
}
}
infile.close();
if(eq==false)
cout<<"\t\t\t\tRECORD NOT FOUND..."<<endl;
cout<<endl;
cout<<"press any key to continue...";
cin.ignore();
cin.get();
}
void modify(int n)
{
system("cls");
student s;
fstream infile;
infile.open("Report.txt",ios::binary|ios::in|ios::out);
if(infile.fail())
{
cout<<"THE FILE COULD NOT BE OPENED..."<<endl;
cin.ignore();
cin.get();
}
bool checker=false;
cout<<"\t\t\t\t==========MODIFY A REPORT CARD==========\n\n";
while(!infile.eof() && checker==false)
{
infile.read(reinterpret_cast<char*>(&s),sizeof(student));
{
if(s.roll_no==n)
{
cout<<"\t\t\t\tSTUDENT NAME :"<<s.name<<endl<<endl;
cout<<"\t\t\t\tSTUDENT ID NUMBER :"<<s.id<<endl<<endl;
cout<<"\t\t\t\tSTUDENT ROLL NUMBER :"<<s.roll_no<<endl<<endl;
cout<<"\t\t\t\tPROGRAMMING MARK :"<<s.prog_m<<endl<<endl;
cout<<"\t\t\t\tCOMPUTER ARCHITECTURE MARK :"<<s.arch_m<<endl<<endl;
cout<<"\t\t\t\tWRITING SKILL MARK :"<<s.writing_sk<<endl<<endl;
cout<<"\t\t\t\tALGEBRA MARK :"<<s.alg_m<<endl<<endl;
cout<<"============================================="<<endl;
cout<<"\t\tENTER THE NEW INFORMATION"<<endl;
cout<<"============================================="<<endl;
cout<<"ENTER YOUR FULL NAME :";
cin.ignore();
cin.getline(s.name,80);
cout<<"ENTER YOUR ID NUMBER : ";
cin.ignore();
cin.get(s.id,80);
cout<<"ENTER YOUR ROLL NUMBER :";
cin>>s.roll_no;
cout<<"ENTER YOUR PROGRAMMING MARK :";
cin>>s.prog_m;
cout<<"ENTER YOUR COMPUTER ARCITECTURE MARK :";
cin>>s.arch_m;
cout<<"ENTER YOUR WRITING SKILL MARK :";
cin>>s.writing_sk;
cout<<"ENTER YOUR ALGEBRA MARK :";
cin>>s.alg_m;
s.sum=s.prog_m+s.arch_m+s.writing_sk+s.alg_m;
s.average=(s.sum/4);
int pos=(-1)*static_cast<int>(sizeof(student));
infile.seekp(pos,ios::cur);
infile.write(reinterpret_cast<char *> (&s), sizeof(student));
cout<<endl;
cout<<"\t\t\t\tTHE FILE IS SUCCESSFULLY updated"<<endl;
checker=true;
}
}
}
infile.close();
if(checker==false)
cout<<"\t\t\t\tRECORD NOT FOUND"<<endl;
cout<<endl;
cout<<"press any key to continue...";
cin.ignore();
cin.get();
}
void deleterecord(int n)
{
system("cls");
student s;
ifstream infile;
infile.open("Report.txt",ios::binary);
if(!infile)
{
cout<<"THE FILE COULD NOT BE OPENED..."<<endl;
cin.ignore();
cin.get();
}
ofstream outfile;
outfile.open("Record2.txt",ios::binary);
infile.seekg(0,ios::beg);
cout<<"\t\t\t\t===========DELETE A REPORT CARD==========\n\n";
while(infile.read(reinterpret_cast<char*>(&s),sizeof(student)))
{
if(s.roll_no!=n)
{
outfile.write(reinterpret_cast<char*>(&s),sizeof(student));
}
}
infile.close();
outfile.close();
remove("Report.txt");
rename("Record2.txt","Report.txt");
cout<<endl;
cout<<"\t\t\t\tRECORD SUCCESSFULLY DELETED"<<endl;
cout<<"press any key to continue...";
cin.ignore();
cin.get();
}