Note - Double Click to Copy Code Contact Us!

Coaching Institute Management System using C++

Tech Doubility
Coaching Institute Management System using C++


 
  1. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2.  
  3. //COACHING INSTITUTE MANAGEMENT SYSTEM
  4.  
  5. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  6.  
  7.  
  8. //Headers inclusion
  9.  
  10.  
  11. #include <iostream>
  12. #include <fstream>
  13. #include <string.h>
  14. #include <conio.h>
  15. #include<cstdlib>
  16.  
  17.  
  18.  
  19. using namespace std;
  20.  
  21. int rec_flag_student=0,no_student=0;
  22. char rec_ind_student[5];
  23.  
  24. int rec_flag_teacher=0,no_teacher=0;
  25. char rec_ind_teacher[5];
  26.  
  27. //Structure defining
  28.  
  29. //For students
  30. struct student
  31. {
  32. char fname[20];//for student first name
  33. char lname[20];//for student last name
  34. char registrationid[20];//for Registration No number
  35. char age[5];//student phone
  36. char feestatus[10];//fee status of students
  37. char cel_no[20];//Phone number
  38. char batch[20];//for class info
  39. char ind[5];//for index
  40.  
  41. }studentData[20];//Variable of student type
  42.  
  43. //For teachers
  44. struct teacher
  45. {
  46. char fst_name[20];//first name of teacher
  47. char lst_name[20];//last name of teacher
  48. char teacherid[20];//id for teacher
  49. char qualification[20];//Qualification of teacher
  50. char pay[10];//Pay of the Teacher
  51. char batch[20];//subject which he/she teach
  52. char cel_no[20];//Phone number
  53. char ind[5];//for index
  54.  
  55.  
  56. }teacherData[20];//Variable of teacher type
  57.  
  58. struct index
  59. {
  60. char registrationid[20],indstudent[20];
  61. }instudent[20],tempstudent;
  62.  
  63. struct index1
  64. {
  65. char teacherid[20],indteacher[20];
  66. }inteacher[20],tempteacher;
  67.  
  68. void sort_index_student()
  69. {
  70. int i,j;
  71.  
  72. for(i=0;i<no_student-1;i++)
  73. for(j=0;j<no_student-i-1;j++)
  74. if(strcmp(instudent[j].registrationid,instudent[j+1].registrationid)>0)
  75. {
  76. tempstudent=instudent[j];
  77. instudent[j]=instudent[j+1];
  78. instudent[j+1]=tempstudent;
  79. }
  80. }
  81.  
  82. void sort_index_teacher()
  83. {
  84.  
  85. int i,j;
  86.  
  87. for(i=0;i<no_teacher-1;i++)
  88. for(j=0;j<no_teacher-i-1;j++)
  89. if(strcmp(inteacher[j].teacherid,inteacher[j+1].teacherid)>0)
  90. {
  91. tempteacher=inteacher[j];
  92. inteacher[j]=inteacher[j+1];
  93. inteacher[j+1]=tempteacher;
  94. }
  95. }
  96.  
  97. void retrive_record_student(char *ind)
  98. {
  99. for(int i=0;i<no_student;i++)
  100. {
  101. if(strcmp(studentData[i].ind,ind)==0)
  102. {
  103. strcpy(rec_ind_student,ind);
  104. rec_flag_student=1;
  105. cout<<"Record found:\n";
  106. cout<<studentData[i].ind<<"\t"<<studentData[i].fname<<"\t"<<studentData[i].lname<<"\t"<<studentData[i].registrationid<<"\t"<<studentData[i].age<<"\t"<<studentData[i].cel_no<<"\t"<<studentData[i].batch<<"\n";
  107. return;
  108. }
  109. }
  110.  
  111. cout<<"Press any key to continue\n";
  112. getch();
  113. }
  114.  
  115. void retrive_record_teacher(char *ind)
  116. {
  117. for(int i=0;i<no_teacher;i++)
  118. {
  119. if(strcmp(teacherData[i].ind,ind)==0)
  120. {
  121. strcpy(rec_ind_teacher,ind);
  122. rec_flag_teacher=1;
  123. cout<<"Record found:\n";
  124. cout<<teacherData[i].ind<<"\t"<<teacherData[i].fst_name<<"\t"<<teacherData[i].lst_name<<"\t"<<teacherData[i].teacherid<<"\t"<<teacherData[i].qualification<<"\t"<<teacherData[i].pay<<"\t"<<teacherData[i].batch<<"\t"<<teacherData[i].cel_no<<"\n";
  125. return;
  126. }
  127. }
  128. cout<<"Press any key to continue\n";
  129. getch();
  130. }
  131.  
  132. int search_index_student(char *registrationid)
  133. {
  134. int flag=0;
  135. for(int i=0;i<no_student;i++)
  136. {
  137. if(strcmp(instudent[i].registrationid,registrationid)==0)
  138. {
  139. retrive_record_student(instudent[i].indstudent);
  140. flag=1;
  141. }
  142. }
  143. if(flag)
  144. return 1;
  145. else
  146. return -1;
  147. }
  148.  
  149. int search_index_teacher(char *teacherid)
  150. {
  151. int flag=0;
  152. for(int i=0;i<no_teacher;i++)
  153. {
  154. if(strcmp(inteacher[i].teacherid,teacherid)==0)
  155. {
  156. retrive_record_teacher(inteacher[i].indteacher);
  157. flag=1;
  158. }
  159. }
  160. if(flag)
  161. return 1;
  162. else
  163. return -1;
  164. }
  165.  
  166. int search_id_student(char *registrationid,int j)
  167. {
  168. int flag=0;
  169. for(int i=0;i<j;i++)
  170. {
  171. if(strcmp(studentData[i].registrationid,registrationid)==0)
  172. {
  173. flag=1;
  174. break;
  175. }
  176. }
  177. if(flag)
  178. return 1;
  179. else
  180. return -1;
  181. }
  182.  
  183. int search_id_teacher(char *teacherid,int j)
  184. {
  185. int flag=0;
  186. for(int i=0;i<j;i++)
  187. {
  188. if(strcmp(teacherData[i].teacherid,teacherid)==0)
  189. {
  190. flag=1;
  191. break;
  192. }
  193. }
  194. if(flag)
  195. return 1;
  196. else
  197. return -1;
  198. }
  199.  
  200.  
  201. void delet_student(char *st_registrationid)
  202. {
  203. rec_flag_student=0;
  204. int fr=0;
  205. search_index_student(st_registrationid);
  206. if(!rec_flag_student)
  207. {
  208. cout<<"Deletion failed.Record not found\n";
  209. cout<<"Press any key to continue\n";
  210. getch();
  211. return;
  212.  
  213. }
  214. for(int i=0;i<no_student;i++)
  215. {
  216. if(strcmp(studentData[i].ind,rec_ind_student)==0)
  217. {
  218. fr=i;
  219. break;
  220. }
  221. }
  222. for(int i=fr;i<no_student-1;i++)
  223. {
  224. studentData[i]=studentData[i+1];
  225. char str[3];
  226. sprintf(str,"%d",i);
  227. strcpy(studentData[i].ind,str);
  228. }
  229. no_student--;
  230. fstream f1,f2;
  231. f1.open("record_student.txt",ios::out);
  232. f2.open("index_student.txt",ios::out);
  233. for(int i=0;i<no_student;i++)
  234. {
  235. strcpy(instudent[i].registrationid,studentData[i].registrationid);
  236. strcpy(instudent[i].indstudent,studentData[i].ind);
  237. }
  238. sort_index_student();
  239. for(int i=0;i<no_student;i++)
  240. {
  241. f1<<studentData[i].ind<<"|"<<studentData[i].fname<<"|"<<studentData[i].lname<<"|"<<studentData[i].registrationid<<"|"<<studentData[i].feestatus<<"|"<<studentData[i].age<<"|"<<studentData[i].cel_no<<"|"<<studentData[i].batch<<"\n";
  242. f2<<instudent[i].registrationid<<"|"<<instudent[i].indstudent<<"\n";
  243. }
  244. f1.close();
  245. f2.close();
  246. cout<<"Deletion successful\n";
  247. cout<<"Press any key to continue\n";
  248. getch();
  249. }
  250.  
  251.  
  252. void delet_teacher(char *st_teacherid)
  253. {
  254. rec_flag_teacher=0;
  255. int fr=0;
  256. search_index_teacher(st_teacherid);
  257. if(!rec_flag_teacher)
  258. {
  259. cout<<"Deletion failed.Record not found\n";
  260. cout<<"Press any key to continue\n";
  261. getch();
  262. return;
  263. }
  264. for(int i=0;i<no_teacher;i++)
  265. {
  266. if(strcmp(teacherData[i].ind,rec_ind_teacher)==0)
  267. {
  268. fr=i;
  269. break;
  270. }
  271. }
  272. for(int i=fr;i<no_teacher-1;i++)
  273. {
  274. teacherData[i]=teacherData[i+1];
  275. char str[3];
  276. sprintf(str,"%d",i);
  277. strcpy(teacherData[i].ind,str);
  278. }
  279. no_teacher--;
  280. fstream f1,f2;
  281. f1.open("record_teacher.txt",ios::out);
  282. f2.open("index_teacher.txt",ios::out);
  283. for(int i=0;i<no_teacher;i++)
  284. {
  285. strcpy(inteacher[i].teacherid,teacherData[i].teacherid);
  286. strcpy(inteacher[i].indteacher,teacherData[i].ind);
  287. }
  288. sort_index_teacher();
  289. for(int i=0;i<no_teacher;i++)
  290. {
  291. f1<<teacherData[i].ind<<"|"<<teacherData[i].fst_name<<"|"<<teacherData[i].lst_name<<"|"<<teacherData[i].teacherid<<"|"<<teacherData[i].qualification<<"|"<<teacherData[i].pay<<"|"<<teacherData[i].batch<<"|"<<teacherData[i].cel_no<<"\n";
  292. f2<<inteacher[i].teacherid<<"|"<<inteacher[i].indteacher<<"\n";
  293. }
  294. f1.close();
  295. f2.close();
  296. cout<<"Deletion successful\n";
  297. cout<<"Press any key to continue\n";
  298. getch();
  299. }
  300.  
  301. void update_status(char *id)
  302. {
  303.  
  304. for (int k = 0;k<no_student;k++)
  305. {
  306. if(strcmp(studentData[k].registrationid,id)==0)
  307. {
  308. if (strcmp(studentData[k].feestatus,"Unpaid")==0)
  309. {
  310. strcpy(studentData[k].feestatus,"Paid");
  311. }
  312. }
  313. }
  314. fstream f1;
  315. f1.open("record_student.txt",ios::out);
  316. for(int k = 0;k<no_student;k++ )
  317. {
  318.  
  319. f1<<studentData[k].ind<<"|"<<studentData[k].fname<<"|"<<studentData[k].lname<<"|"<<studentData[k].registrationid<<"|"<<studentData[k].feestatus<<"|"<<studentData[k].age<<"|"<<studentData[k].cel_no<<"|"<<studentData[k].batch<<"\n";
  320. }
  321. f1.close();
  322. cout<<"Updation successful";
  323. cout<<"Press any key to continue";
  324. getch();
  325. }
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333. ///////////////////////////////////////////////////
  334. //Main function
  335.  
  336. int main()
  337. {
  338.  
  339. char fname[20];//for student first name
  340. char lname[20];//for student last name
  341. char registrationid[20];//for Registration No number
  342. char st_registrationid[20];
  343. char age[5];//student phone
  344. char feestatus[10];//fee status of student
  345. char cel_no_student[20];//Phone number
  346. char batch_student[20];//for class info
  347. char ind_student[5];//for index
  348.  
  349. char fst_name[20];//first name of teacher
  350. char lst_name[20];//last name of teacher
  351. char teacherid[20];//id for teacher
  352. char st_teacherid[20];
  353. char qualification[20];//Qualification of teacher
  354. char pay[10];//Pay of the Teacher
  355. char batch_teacher[20];//subject which he/she teach
  356. char cel_no_teacher[20];//Phone number
  357. char ind_teacher[5];//for index
  358.  
  359. fstream file1;
  360. int i=0,j;//for processing usage
  361. char choice;//for getting choice
  362.  
  363.  
  364. fstream file2;
  365. file1.open("record_student.txt",ios::in);
  366. file2.open("index_student.txt",ios::out);
  367. for(int i=0;i<100;i++)
  368. {
  369. file1.getline(studentData[i].ind,5,'|');
  370. file1.getline(studentData[i].fname,20,'|');
  371. file1.getline(studentData[i].lname,20,'|');
  372. file1.getline(studentData[i].registrationid,20,'|');
  373. file1.getline(studentData[i].feestatus,10,'|');
  374. file1.getline(studentData[i].age,5,'|');
  375. file1.getline(studentData[i].cel_no,20,'|');
  376. file1.getline(studentData[i].batch,20,'\n');
  377. strcpy(instudent[i].registrationid,studentData[i].registrationid);
  378. strcpy(instudent[i].indstudent,studentData[i].ind);
  379. int m=atoi(studentData[i].ind);
  380. if(i==m)
  381. no_student++;
  382. else
  383. break;
  384.  
  385. }
  386. sort_index_student();
  387. for(int i=0;i<no_student;i++)
  388. {
  389. file2<<instudent[i].registrationid<<"|"<<instudent[i].indstudent<<"\n";
  390. }
  391. file1.close();
  392. file2.close();
  393. fstream f11,f21;
  394. f11.open("record_teacher.txt",ios::in);
  395. f21.open("index_teacher.txt",ios::out);
  396. for(int i=0;i<100;i++)
  397. {
  398. f11.getline(teacherData[i].ind,5,'|');
  399. f11.getline(teacherData[i].fst_name,20,'|');
  400. f11.getline(teacherData[i].lst_name,20,'|');
  401. f11.getline(teacherData[i].teacherid,20,'|');
  402. f11.getline(teacherData[i].qualification,20,'|');
  403. f11.getline(teacherData[i].pay,10,'|');
  404. f11.getline(teacherData[i].batch,20,'|');
  405. f11.getline(teacherData[i].cel_no,10,'\n');
  406. strcpy(inteacher[i].teacherid,teacherData[i].teacherid);
  407. strcpy(inteacher[i].indteacher,teacherData[i].ind);
  408. int m=atoi(teacherData[i].ind);
  409. if(i==m)
  410. no_teacher++;
  411. else
  412. break;
  413. }
  414. sort_index_teacher();
  415. for(int i=0;i<no_teacher;i++)
  416. {
  417. f21<<inteacher[i].teacherid<<"|"<<inteacher[i].indteacher<<"\n";
  418. }
  419. f11.close();
  420. f21.close();
  421.  
  422.  
  423.  
  424.  
  425. while(1)//outer loop
  426. {
  427. system("cls");//Clear screen
  428. //Level 1-Display process
  429. cout<<"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\";
  430. cout<<"\n\n\t\t\t\t\tCOACHING INSTITUTE MANAGEMENT SYSTEM\n\n";
  431. cout<<"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\";
  432. cout<<"\n\n\t\t\t\t\t\tHOME PAGE\n\n";
  433. cout<<"This is a Coaching institute management system,used to maintain the records of students and teachers in the Coaching\n";
  434. cout<<"\t\t\tThe two basic sections on the software are: \n";
  435. cout<<"\t\t\t1.Student Section\n";
  436. cout<<"\t\t\t2.Teachers Section\n\n";
  437. cout<<"Which section do you want to enter? Choose an option from the menu.\n";
  438. cout<<"1.Students information"<<endl;
  439. cout<<"2.Teacher information"<<endl;
  440. cout<<"3.Exit program"<<endl;
  441. cin>>choice;
  442.  
  443. system("cls");//Clear screen
  444.  
  445.  
  446. switch(choice)//First switch
  447. {
  448.  
  449. case '1': //Student
  450. {
  451. int n;
  452. while(1)//inner loop-1
  453. {
  454. system("cls");//Clear screen
  455. //Level-2 display
  456. cout<<"\n\n\t\t\t\t\tSTUDENTS INFORMATION AND BIO DATA SECTION\n\n\n";
  457. cout<<"Enter your choice: "<<endl;
  458. cout<<"1.New Admission\n";
  459. cout<<"2.Find Student\n";
  460. cout<<"3.Check fee status\n";
  461. cout<<"4.Remove Student\n";
  462. cout<<"5.Display Students Batch-wise\n";
  463. cout<<"6.Display all Students\n";
  464. cout<<"7.Update Fee status\n";
  465. cout<<"8.Jump to Main Menu\n";
  466. cin>>choice;
  467.  
  468. switch (choice)//Second switch
  469.  
  470. {
  471. case '1'://Insert data
  472. {
  473. file1.open("record_student.txt",ios::app|ios::out);
  474.  
  475. while(choice!='n')
  476. {
  477.  
  478. if((choice=='y')||(choice=='Y')||(choice=='1'))
  479. {
  480.  
  481. cout<<"enter the no of students:\t";
  482. cin>>n;
  483. cout<<"enter the details\n";
  484. for(i = no_student;i<no_student+n;i++)
  485. {
  486. label: cout<<"enter "<<i+1<<" student details:\n";
  487. cout<<"First name : ";
  488. cin>>studentData[i].fname;
  489. cout<<"Last name : ";
  490. cin>>studentData[i].lname;
  491. cout<<"Registration Id : ";
  492. cin>>studentData[i].registrationid;
  493. cout<<"Fee Status : ";
  494. cin>>studentData[i].feestatus;
  495. cout<<"Age : ";
  496. cin>>studentData[i].age;
  497. cout<<"Batch Allotted : ";
  498. cin>>studentData[i].batch;
  499. cout<<"Contact Number : ";
  500. cin>>studentData[i].cel_no;
  501. int q = search_id_student(studentData[i].registrationid,i);
  502. if(q==1)
  503. {
  504. cout<<"Duplicate value\n";
  505. cout<<"enter again:\n";
  506. goto label;
  507. }
  508. file1<<i<<"|"<<studentData[i].fname<<"|"<<studentData[i].lname<<"|"<<studentData[i].registrationid<<"|"<<studentData[i].feestatus<<"|"<<studentData[i].age<<"|"<<studentData[i].cel_no<<"|"<<studentData[i].batch<<"\n";
  509.  
  510. }
  511. no_student=no_student+n;
  512. cout<<"Do you want to enter more data?\n ";
  513. cout<<"Press Y for Continue and N to Finish: ";
  514. cin>>choice;
  515.  
  516. }
  517. }
  518. file1.close();
  519.  
  520. fstream file1,file2;
  521. file1.open("record_student.txt",ios::in);
  522. file2.open("index_student.txt",ios::out);
  523. for(int i=0;i<no_student;i++)
  524. {
  525. file1.getline(ind_student,5,'|');
  526. file1.getline(fname,20,'|');
  527. file1.getline(lname,20,'|');
  528. file1.getline(registrationid,20,'|');
  529. file1.getline(feestatus,10,'|');
  530. file1.getline(age,5,'|');
  531. file1.getline(cel_no_student,20,'|');
  532. file1.getline(batch_student,20,'\n');
  533. strcpy(studentData[i].ind,ind_student);
  534. strcpy(instudent[i].registrationid,registrationid);
  535. strcpy(instudent[i].indstudent,ind_student);
  536. }
  537. sort_index_student();
  538. for(int i=0;i<no_student;i++)
  539. {
  540. file2<<instudent[i].registrationid<<"|"<<instudent[i].indstudent<<"\n";
  541. }
  542. file1.close();
  543. file2.close();
  544. }
  545. continue;//control back to inner loop -1
  546.  
  547. case '2'://search data
  548. {
  549. cout<<"Enter the Id of the student whose record is to be searched:\t";
  550. cin>>st_registrationid;
  551. int q=search_index_student(st_registrationid);
  552. if(q==1){
  553. cout<<"Search successful\n";
  554. cout<<"Press any key to continue\n";
  555. getch();
  556. }
  557. else{
  558. cout<<"Search unsuccessful\n";
  559. cout<<"Press any key to continue\n";
  560. getch();
  561. }
  562.  
  563. }
  564. continue;//control back to inner loop -1
  565.  
  566. case '3'://print fee status
  567. {
  568. char ch;
  569. cout<<"Choose the kind of status\n";
  570. cout<<"1.Paid\n";
  571. cout<<"2.Unpaid\n";
  572. cin>>ch;
  573. if(ch== '1')
  574. {
  575. cout<<"Students who have paid the fees\n";
  576. for (int k=0;k<no_student;k++)
  577. {
  578. if (strcmp(studentData[k].feestatus,"Paid")==0)
  579. {
  580. cout<<studentData[k].fname<<"\t"<<studentData[k].lname<<"\t"<<studentData[k].registrationid<<"\t"<<studentData[k].feestatus<<"\t"<<studentData[k].age<<"\t"<<studentData[k].cel_no<<"\t"<<studentData[k].batch<<endl;
  581. }
  582.  
  583.  
  584. }
  585.  
  586. }
  587.  
  588. else if(ch == '2'){
  589.  
  590. cout<<"Students who have not paid the fees\n";
  591. for (int k=0;k<no_student;k++)
  592. {
  593. if (strcmp(studentData[k].feestatus,"Unpaid")==0)
  594. {
  595. cout<<studentData[k].fname<<"\t"<<studentData[k].lname<<"\t"<<studentData[k].registrationid<<"\t"<<studentData[k].feestatus<<"\t"<<studentData[k].age<<"\t"<<studentData[k].cel_no<<"\t"<<studentData[k].batch<<endl;
  596. }
  597.  
  598.  
  599. }
  600.  
  601.  
  602. }
  603. cout<<"Press any key to continue";
  604. getch();
  605.  
  606. }
  607.  
  608. continue;
  609.  
  610. case '4'://delete data
  611.  
  612. {
  613. cout<<"Enter the Id of the student whose record is to be deleted:\t";
  614. cin>>st_registrationid;
  615. delet_student(st_registrationid);
  616. }
  617. continue;//control back to inner loop -1
  618.  
  619. case '5'://display students batch-wise
  620. {
  621. char bat[10];
  622. cout<<"Enter the batch whose record you want to display\n";
  623. cin>>bat;
  624. for(int k = 0;k<no_student;k++)
  625. {
  626. if(strcmp(studentData[k].batch,bat)==0)
  627. {
  628. cout<<studentData[k].fname<<"\t"<<studentData[k].lname<<"\t"<<studentData[k].registrationid<<"\t"<<studentData[k].age<<"\t"<<studentData[k].cel_no<<"\t"<<studentData[k].batch<<endl;
  629.  
  630. }
  631. }
  632.  
  633. cout<<"Press any key to continue\n";
  634. getch();
  635. }
  636. continue;
  637.  
  638.  
  639.  
  640. case '6'://display all data
  641. {
  642. fstream f1;
  643. f1.open("record_student.txt",ios::in);
  644. if(!f1)
  645. {
  646. cout<<"Error!!!";
  647. exit(0);
  648. }
  649. int i=0;
  650. while(i!=no_student)
  651. {
  652. cout<<studentData[i].ind<<"\t"<<studentData[i].fname<<"\t"<<studentData[i].lname<<"\t"<<studentData[i].registrationid<<"\t"<<studentData[i].age<<"\t"<<studentData[i].cel_no<<"\t"<<studentData[i].batch<<"\n";
  653. i++;
  654. }
  655. f1.close();
  656. cout<<"Press any key to continue\n";
  657. getch();
  658. }
  659. continue;
  660.  
  661. case '7': {
  662. char id[20];
  663. cout<<"Students who have not paid the fees\n";
  664. for (int k=0;k<no_student;k++)
  665. {
  666. if (strcmp(studentData[k].feestatus,"Unpaid")==0)
  667. {
  668. cout<<studentData[k].fname<<"\t"<<studentData[k].lname<<"\t"<<studentData[k].registrationid<<"\t"<<studentData[k].feestatus<<"\t"<<studentData[k].age<<"\t"<<studentData[k].cel_no<<"\t"<<studentData[k].batch<<endl;
  669. }
  670.  
  671.  
  672. }
  673.  
  674. cout<<"Enter the Id of the student whose status you want to update\n";
  675. cin>>id;
  676. update_status(id);
  677.  
  678.  
  679. }
  680. continue;
  681.  
  682. case '8'://Jump to main
  683. {
  684. break;//inner switch breaking
  685. }
  686. }
  687.  
  688. break;//inner loop-1 breaking
  689. }
  690. continue;//Control pass to 1st loop
  691. }
  692.  
  693. case '2'://Teachers biodata
  694. {
  695. int n;
  696. while(1)//inner loop-1
  697. {
  698. system("cls");//Clear screen
  699. //Level-2 display
  700. cout<<"\n\n\t\t\t\t\tTEACHERS INFORMATION AND BIO DATA SECTION\n\n\n";
  701. cout<<"Enter your choice: "<<endl;
  702. cout<<"1.Create new entry\n";
  703. cout<<"2.Find Teacher\n";
  704. cout<<"3.Remove Teacher\n";
  705. cout<<"4.Batches-wise display\n";
  706. cout<<"5.Students assigned\n";
  707. cout<<"6.Display all Teachers\n";
  708. cout<<"7.Jump to Main Menu\n";
  709. cin>>choice;
  710.  
  711. switch (choice)//Second switch
  712.  
  713. {
  714. case '1'://Insert data
  715. {
  716. file1.open("record_teacher.txt",ios::app|ios::out);
  717.  
  718. for( i=0;choice!='n';i++)
  719. {
  720.  
  721. if((choice=='y')||(choice=='Y')||(choice=='1'))
  722. {
  723.  
  724. cout<<"Enter the no of Teachers:\t";
  725. cin>>n;
  726. cout<<"enter the Details\n";
  727. for(int i=no_teacher;i<no_teacher+n;i++)
  728. {
  729. label1: cout<<"enter "<<i+1<<" teacher details:\n";
  730. cout<<"First name : ";
  731. cin>>teacherData[i].fst_name;
  732. cout<<"Last name : ";
  733. cin>>teacherData[i].lst_name;
  734. cout<<"Qualification : ";
  735. cin>>teacherData[i].qualification;
  736. cout<<"Teacher Id : ";
  737. cin>>teacherData[i].teacherid;
  738. cout<<"Pay=";
  739. cin>>teacherData[i].pay;
  740. cout<<"Batch Allotted : ";
  741. cin>>teacherData[i].batch;
  742. cout<<"Contact Number : ";
  743. cin>>teacherData[i].cel_no;
  744. int q=search_id_teacher(teacherData[i].teacherid,i);
  745. if(q==1)
  746. {
  747. cout<<"duplicate value\n";
  748. cout<<"enter again:\n";
  749. goto label1;
  750. }
  751. file1<<i<<"|"<<teacherData[i].fst_name<<"|"<<teacherData[i].lst_name<<"|"<<teacherData[i].teacherid<<"|"<<teacherData[i].qualification<<"|"<<teacherData[i].pay<<"|"<<teacherData[i].batch<<"|"<<teacherData[i].cel_no<<"\n";
  752.  
  753.  
  754. }
  755. no_teacher=no_teacher+n;
  756. cout<<"Do you want to enter data?\n ";
  757. cout<<"Press Y for Continue and N to Finish: ";
  758. cin>>choice;
  759.  
  760. }
  761. }
  762. file1.close();
  763.  
  764. fstream file1,file2;
  765. file1.open("record_teacher.txt",ios::in);
  766. file2.open("index_teacher.txt",ios::out);
  767. for(int i=0;i<no_teacher;i++)
  768. {
  769. file1.getline(ind_teacher,5,'|');
  770. file1.getline(fst_name,20,'|');
  771. file1.getline(lst_name,20,'|');
  772. file1.getline(teacherid,20,'|');
  773. file1.getline(qualification,20,'|');
  774. file1.getline(pay,10,'|');
  775. file1.getline(batch_teacher,20,'|');
  776. file1.getline(cel_no_teacher,10,'\n');
  777. strcpy(teacherData[i].ind,ind_teacher);
  778. strcpy(inteacher[i].teacherid,teacherid);
  779. strcpy(inteacher[i].indteacher,ind_teacher);
  780. }
  781.  
  782. sort_index_teacher();
  783. for(int i=0;i<no_teacher;i++)
  784. {
  785. file2<<inteacher[i].teacherid<<"|"<<inteacher[i].indteacher<<"\n";
  786. }
  787. file1.close();
  788. file2.close();
  789. }
  790. continue;//control back to inner loop -1
  791.  
  792. case '2'://Display data
  793. {
  794. cout<<"Enter the Id of the teacher whose record is to be searched:\t";
  795. cin>>st_teacherid;
  796. int q=search_index_teacher(st_teacherid);
  797. if(q==1){
  798. cout<<"Search successful\n";
  799. cout<<"Press any key to continue\n";
  800. getch();
  801. }
  802. else{
  803. cout<<"Search unsuccessful\n";
  804. cout<<"Press any key to continue\n";
  805. getch();
  806. }
  807.  
  808. }
  809. continue;//control back to inner loop -1
  810.  
  811. case '3':
  812.  
  813. {
  814. cout<<"Enter the Id of the teacher whose record is to be deleted:\t";
  815. cin>>st_teacherid;
  816. delet_teacher(st_teacherid);
  817. }
  818. continue;//control back to inner loop -1
  819.  
  820.  
  821. case '4':
  822. {
  823. char bat[20];
  824. cout<<"See the teachers assigned to the batch, Enter the Batch name\n";
  825. cin>>bat;
  826. for(int k = 0;k<no_teacher;k++)
  827. {
  828. if(strcmp(studentData[k].batch,bat)==0)
  829. {
  830. cout<<teacherData[k].fst_name<<"\t"<<teacherData[k].lst_name<<"\t"<<teacherData[k].teacherid<<"\t"<<teacherData[k].batch<<endl;
  831. }
  832. }
  833.  
  834. cout<<"Press any key to continue\n";
  835. getch();
  836.  
  837. }
  838. continue;
  839.  
  840.  
  841. case '5':
  842.  
  843. {
  844. char id[20];
  845. cout<<"Enter id of the teacher to see the students assigned\n";
  846. cin>>id;
  847. char bat[20];
  848.  
  849. for(int i = 0;i<no_teacher;i++)
  850. {
  851. if(strcmp(teacherData[i].teacherid,id)==0)
  852. {
  853. strcpy(bat,teacherData[i].batch);
  854.  
  855. }
  856. }
  857.  
  858. for(int k=0;k<no_teacher;k++)
  859. {
  860.  
  861. if(strcmp(studentData[k].batch,bat)==0)
  862. {
  863. cout<<studentData[k].fname<<"\t"<<studentData[k].lname<<"\t"<<studentData[k].registrationid<<"\t"<<studentData[k].age<<"\t"<<studentData[k].cel_no<<endl;
  864. }
  865.  
  866. }
  867. cout<<"Press any key to continue";
  868. getch();
  869.  
  870. }
  871. continue;
  872.  
  873.  
  874.  
  875. case '6':
  876. {
  877. fstream f1;
  878. f1.open("record_teacher.txt",ios::in);
  879. if(!f1)
  880. {
  881. cout<<"Error!!!";
  882. exit(0);
  883. }
  884. int i=0;
  885. while(i!=no_teacher)
  886. {
  887. cout<<teacherData[i].ind<<"\t"<<teacherData[i].fst_name<<"\t"<<teacherData[i].lst_name<<"\t"<<teacherData[i].teacherid<<"\t"<<teacherData[i].qualification<<"\t"<<teacherData[i].pay<<"\t"<<teacherData[i].batch<<"\t"<<teacherData[i].cel_no<<"\n";
  888. i++;
  889.  
  890. }
  891. f1.close();
  892. cout<<"Press any key to continue\n";
  893. getch();
  894. }
  895. continue;
  896.  
  897.  
  898. case '7'://Jump to main
  899. {
  900. break;//inner switch breaking
  901. }
  902. }
  903.  
  904. break;//inner loop-1 breaking
  905. }
  906. continue;//Control pass to 1st loop
  907. }
  908.  
  909.  
  910. case '3':
  911. {
  912. break;//outer case 3
  913. }//outer case 3
  914. }
  915. break;//outer loop
  916. }
  917.  
  918.  
  919. }

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.