The College information system using C is a location where a student can have all the information  they need. Each section  have different information according to need of student like search class routine, bus schedule, teacher information, subject  list per /sem and campus information. This system is very useful for fresher student because they have no idea about collage teachers and many more thing. Also this system is useful for individual teacher because some time teacher forget class routine. Here is mainly two section which describe below:-
1.1 Student Section:- Â This section include the all information about collage, teachers, bus schedule, subject list and class routine student can only able to search the above information but they cant alter with the information.
1.2 Admin Section:-This section is password protected. It includes several menus like add info, search info, edit info, delete info. These menu have different functions like add info adds the more information, edit info edits the previous information, search includes searching specific information and delete deletes the information.  Here authorized person can change the information, edit them & update them. Only the  authorized person can alter with the data provided. Administrator can login from the main menu.
College Information system is a project which provides information about college and teachers .In this  project we will be able to know about history of College as well as we can know time schedule of class. It provides several information about the college which will be helpful for the students. In this system there are two section (Admin & student).Admin section have their separate login system. With the password given to Admin, they can access the page from where they can change ,update, delete the information
Only the administrator will have that password. In other hand ,the student section can be accessed by everyone. Here they can have the information they need. Student can see their bus routine. Usually the student have timing problem a lot. Bus timing could be very complicated to them to manage. So they will have their bus routine before the college starts and they can manage their time when there is enough time to think. Our system also have the class schedule, key dates and subject list.
Usually fresher students have no idea about the subjects they are going to study. So if they know about them they can prepare from beginning of the subject. They will also have the key dates like first assessment, attendance publishing etc.Most students have problems like speaking in mass. So they don’t ask their confusions and also don’t know about teachers. We give information about teacher including contact no. so they can ask for help in their comfort.
As we had already discuss how to start code in “C” and preparation for programming in “Student Information System Using C“.
The thing you have to do is, Â simply paste the following code in the source file and compile, execute it.
The Code:-
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 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 |
#include<stdio.h> #include<conio.h> #include<string.h> #include<windows.h> #include<stdlib.h> #include<time.h> void mainmenu(); void student(); void admin(); void password(); void addteacherinfo(); void displayteacherinfo(); void displayroutine(); void addclassroutine(); void subjectlist(); void searchsub(); void addcollageinfo(); void displaycollageinfo(); void addbuschedule(); void searchbusinfo(); void editclassroutine(); void editbusinfo(); void editeacherinfo(); void deleteclassroutine(); void deleteteacherinfo(); void deletebusinfo(); void searchclasschedule(); void searbusschedule(); void searteacherinfo(); typedef struct { char busno[20]; char phone[30]; char stop[200]; }bus; bus b; struct routine { char day[50]; char one[25]; char two[25]; char three[25]; char four[25]; char five[25]; char sic[25]; char seven[25]; char eight[25]; }; struct routine r; struct subject { char subname[25]; int marks; }; struct subject s; typedef struct { char name[30]; char qualify[30]; char phone[11]; char design[30]; }teach; teach t; typedef struct { char info[1000]; }infom; infom inf; char pass[10]={"bep"}; int i,j,k,l,m,n,p,d; FILE *fptr; void gotoxy (int x, int y) { COORD coord = { 0 ,0 }; coord.X = x; coord.Y = y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord); } int main() { mainmenu(); getch(); } void mainmenu() { char d[40] = "WELCOME TO COLLEGE INFO SYSTEM"; int i,j,k,l,m; gotoxy(20,5); for(j=0;j<40;j++) { Sleep(10); printf("\xb2"); } gotoxy(20,5);printf("\xB2"); Sleep(20); gotoxy(20,6);printf("\xB2"); Sleep(20); gotoxy(20,7);printf("\xB2"); Sleep(20); gotoxy(20,8);printf("\xB2"); gotoxy(20,9);printf("\xB2"); Sleep(20); gotoxy(20,10);printf("\xB2"); Sleep(20); gotoxy(20,11);printf("\xB2"); Sleep(20); gotoxy(20,12);printf("\xB2"); gotoxy(20,13);printf("\xB2"); Sleep(20); gotoxy(20,14);printf("\xB2"); Sleep(20); gotoxy(20,15);printf("\xB2"); Sleep(20); gotoxy(20,16);printf("\xB2"); gotoxy(20,17);printf("\xB2"); Sleep(20); gotoxy(20,18);printf("\xB2"); Sleep(20); gotoxy(20,19);printf("\xB2"); Sleep(20); gotoxy(20,20);printf("\xB2"); gotoxy(60,5);printf("\xB2"); Sleep(20); gotoxy(60,6);printf("\xB2"); Sleep(20); gotoxy(60,7);printf("\xB2"); Sleep(20); gotoxy(60,8);printf("\xB2"); Sleep(20); gotoxy(60,9);printf("\xB2"); gotoxy(60,9);printf("\xB2"); Sleep(20); gotoxy(60,10);printf("\xB2"); Sleep(20); gotoxy(60,11);printf("\xB2"); Sleep(20); gotoxy(60,12);printf("\xB2"); Sleep(20); gotoxy(60,13);printf("\xB2"); Sleep(20); gotoxy(60,14);printf("\xB2"); Sleep(20); gotoxy(60,15);printf("\xB2"); Sleep(20); gotoxy(60,16);printf("\xB2"); Sleep(20); gotoxy(60,17);printf("\xB2"); Sleep(20); gotoxy(60,18);printf("\xB2"); Sleep(20); gotoxy(60,19);printf("\xB2"); Sleep(20); gotoxy(60,20);printf("\xB2"); gotoxy(20,20); for(j=0;j<40;j++) { Sleep(20); printf("\xb2"); } gotoxy(20,9); for(j=0;j<40;j++) { Sleep(20); printf("\xb2"); } gotoxy(21,7); printf("\t "); for(m=0;m<30;m++) { Sleep(50); printf("%c",d[m]); } gotoxy(23,11); printf("\t \xdb\xdb\xdb\xb2 S. Student"); gotoxy(23,14); printf("\t \xdb\xdb\xdb\xb2 A.Admin "); gotoxy(23,17); printf("\t \xdb\xdb\xdb\xb2 Q.Quit "); char n; gotoxy(21,22); printf("Enter choice: "); n=getch(); switch(n) { case 's': student(); break; case 'a': system("cls"); password(); break; case 'q': system("cls"); default: printf("\n\a\t\t\t Invalid choice!!"); Sleep(1000); system("cls"); mainmenu(); } } void student() { system("cls"); printf("\n\n\n\t\t\t\xb2\xb2\xb2\xb2\xb2\xb2\xb2 STUDENT SECTION \xb2\xb2\xb2\xb2\xb2\xb2\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 1.Class schedule \n"); printf("\n\t\t\t\xdb\xdb\xdb\xb2 2.Bus schedule \n"); printf("\n\t\t\t\xdb\xdb\xdb\xb2 3. Teacher info\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 4. College info\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 5. Subject list\n\n"); printf("\t\t\t\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\n"); printf("\n enter your choice"); int de; scanf("%d",&de); switch(de) { case 1: searchclasschedule(); break; case 2: searbusschedule(); break; case 3: searteacherinfo(); break; case 4: displaycollageinfo(); break; case 5: searchsub(); break; default: printf("\aInvalid choice"); break; } } void admin() { char sl; system("cls"); printf("\n\n\n\t\t\t\xb2\xb2\xb2\xb2\xb2\xb2\xb2 ADMIN SECTION \xb2\xb2\xb2\xb2\xb2\xb2\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 A. Add info\n"); printf("\n\t\t\t\xdb\xdb\xdb\xb2 S. Search info\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 E. Edit info\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 D. Delete info\n\n"); printf("\t\t\t\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\n"); printf("\t\t\tEnter your choice"); sl=getch(); switch(sl) { case 'a': system("cls"); printf("\n\n\n\t\t\t\xb2\xb2\xb2\xb2\xb2\xb2\xb2 Add info\xb2\xb2\xb2\xb2\xb2\xb2\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 1.Class Routine \n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 2.Bus Schedule \n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 3. Teacher info\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 4. College info\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 5. Subject List\n\n"); printf("\t\t\t\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\n"); printf("\t\t\tEnter your choice"); int ch; scanf("%d",&ch); switch(ch) { case 1: addclassroutine(); break; case 2: addbuschedule(); break; case 5: subjectlist(); break; case 3: addteacherinfo(); break; case 4: addcollageinfo(); break; default: printf("\ainvalid choice!!"); break; } break; case 's': system("cls"); printf("\n\n\n\t\t\t\xb2\xb2\xb2\xb2\xb2\xb2\xb2 Search info\xb2\xb2\xb2\xb2\xb2\xb2\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 1.Class Routine \n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 2.Bus Schedule \n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 3. Teacher info\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 4. College info\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 5. Subject List\n\n"); printf("\t\t\t\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\n"); printf("\t\t\tEnter your choice"); int choice; scanf("%d",&choice); switch(choice) { case 1: displayroutine(); break; case 2: searchbusinfo(); break; case 4: displaycollageinfo(); break; case 5: searchsub(); break; case 3: displayteacherinfo(); break; default: printf("\ainvalid choice"); break; } case 'e': system("cls"); printf("\n\n\n\t\t\t\xb2\xb2\xb2\xb2\xb2\xb2\xb2 Edit info\xb2\xb2\xb2\xb2\xb2\xb2\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 1.Class Routine \n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 2.Bus Schedule \n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 3. Teacher info\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 4. College info\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 5. Subject List\n\n"); printf("\t\t\t\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\n"); printf("\t\t\tEnter your choice"); int ed; scanf("%d",&ed); switch(ed) { case 1: editclassroutine(); break; case 2: editbusinfo(); break; case 3: editeacherinfo(); break; default: printf("\ainvalid choice"); break; } case 'd': system("cls"); printf("\n\n\n\t\t\t\xb2\xb2\xb2\xb2\xb2\xb2\xb2 Delete info\xb2\xb2\xb2\xb2\xb2\xb2\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 1.Class Routine \n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 2.Bus Schedule \n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 3. Teacher info\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 4. College info\n\n"); printf("\t\t\t\xdb\xdb\xdb\xb2 5. Subject List\n\n"); printf("\t\t\t\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\xb2\n"); printf("\t\t\tEnter your choice"); int de; scanf("%d",&de); switch(de) { case 1: deleteclassroutine(); break; case 2: deletebusinfo(); break; case 3: deleteteacherinfo(); break; default: printf("\ainvalid choice"); break; } break; } } void password() { system("cls"); int v=1; for(v=1;v<=5;v++) { printf("\n\n\n\t\t"); char ch=0,passw[10]; printf("\n\n\n\n\n\n\t\t***** Password Protected *****"); printf("\n\n\t\tEnter Password:"); while(ch!=13) { ch=getch(); if(ch!=13) { putch('*'); passw[i] = ch; i++; } } passw[i] = '\0'; if(strcmp(pass,passw)==0) { admin(); break; } else { i=0; printf("\a\n\n\t\twrong password !"); Sleep(1000); system("cls"); printf("\n\n\t\Your Try %d's",v); if(v==4) { system("cls"); printf("\a\nThis is your last chance pls type correct password \n Otherwise you have to wait 20 sec !!"); } else if(v==5) { system("cls"); printf("\n\n\n\n\n\n\n\t\t\t\tPls try after 20 sec\n"); Sleep(2000); int count=20; do { Sleep(1000); system("cls"); count--; printf("\n\n\n\n\n\n\n\t\t\t\tWait...\a %d",count); }while(count!=0); system("cls"); password(); } } } } void addteacherinfo() { fptr=fopen("E:/project/teacherinfo.txt","ab+"); if(fptr==NULL) { printf("error in opening file"); getch(); } while(1) { printf("\nEnter teachers full name\n"); scanf("%s[^\n]",&t.name); printf("\nenter qaualificaton\n "); scanf("\n%s[^\n]",&t.qualify); printf("\nenter phone no "); scanf("\n%s[^\n]",&t.phone); printf("\nenter desination"); scanf("\n%s[^\n]",&t.design); fwrite(&t,sizeof(t),1,fptr); fflush(stdin); printf("\nRecord sucessfully added"); printf("press Esc key to admin section or other key to continue"); char ex; ex=getch(); if(ex==27) exit(1); } fclose(fptr); } void displayteacherinfo() { system("cls"); printf("*************TEACHER INFORMATION************\n\n"); int i,j; fptr=fopen("E:/project/teacherinfo.txt","rb+"); if(fptr==NULL) { printf("error in opening file"); getch(); } for(i=0;i<=70;i++) printf("-"); while(fread(&t,sizeof(t),1,fptr)==1) { printf("\nName: %s\n\nPhone no: %s\n\nQualification: %s\n\nDesination: %s\n",t.name,t.phone,t.qualify,t.design); for(j=0;j<=70;j++) printf("-"); } fclose(fptr); getch(); } void addclassroutine() { FILE *f; char test; f=fopen("E:/project/classroutine.txt","ab+"); if(f==0) { f=fopen("E:/project/classroutine.txt","wb+"); system("cls"); printf("please wait while we configure your computer"); printf("/npress any key to continue"); getch(); } while(1) { system("cls"); int i=1; printf("\n enter day:"); scanf("%s[^\n]",&r.day); fflush(stdin); printf("\n Enter 1st period:"); scanf("%s[^\n]",&r.one); printf("\n Enter 2nd period:"); scanf("%s[^\n]",&r.two); printf("\n Enter 3rd period:"); scanf("%s[^\n]",&r.three); printf("\n Enter 4th period:"); scanf("%s[^\n]",&r.four); printf("\n Enter 5th period:"); scanf("%s[^\n]",&r.five); printf("\n Enter 6th period:"); scanf("%s",&r.sic); fwrite(&r,sizeof(r),1,f); fflush(stdin); system("cls"); printf("\n1 record successfully added"); i++; printf("\n Press esc key to exit, any other key to add other record:"); test=getche(); if(test==27) break; } fclose(f); } void displayroutine() { FILE *f; int i; if((f=fopen("E:/project/classroutine.txt","rb"))==NULL) exit(0); system("cls"); printf(" 10:30-11:15 11:15-12 12-12:45 12:45-1:30 1:30-2:15 2:15-3 3-3:45 3:45-4:30"); for(i=0;i<79;i++) printf("-"); while(fread(&r,sizeof(r),1,f)==1) { printf("\n%s %s %s %s %s %s",r.day,r.one,r.two,r.three,r.four,r.five,r.sic); printf("\n"); for(i=0;i<79;i++) printf("-"); } fclose(f); getch(); } void subjectlist() { system("cls"); fptr=fopen("E:/project/subjectlist.txt","ab+"); if(fptr==NULL) { printf("error"); getch(); } while(1) { int i=1; printf("\nenter subject name%d\n",i); scanf("%s",&s.subname); printf("\nenter marks\n"); scanf("%d",&s.marks); fwrite(&s,sizeof(s),1,fptr); fflush(stdin); printf("\n %d record added",i); i++; printf("\npress ecs key to exit or other key to continue add another record"); char ch; ch=getch(); if(ch==27) break; } getch(); } void searchsub() { system("cls"); int i,temp,sum=0; if((fptr=fopen("E:/project/subjectlist.txt","rb"))==NULL) { printf("error"); getch(); } printf("SUB.\t\t\tMARK\n") ; while(fread(&s,sizeof(s),1,fptr)==1) { for(i=0;i<40;i++) { printf("-"); } printf("\n %s\t\t%d\n",s.subname,s.marks); temp=s.marks; sum+=temp; } for(i=0;i<40;i++) { printf("-"); } printf("\nTotal\t\t\t%d",sum); getch(); } void addcollageinfo() { system("cls"); fptr=fopen("E:/project/collegeinfo.txt","ab+"); while(1) { printf("enter collage info"); scanf("%s[^\n]",&inf.info); fwrite(&inf,sizeof(inf),1,fptr); fflush(stdin); printf("record sucessfully added\n"); printf("\npress ESC key to exit"); char ch; ch=getch(); exit(1); } fclose(fptr); } void displaycollageinfo() { system("cls"); fptr=fopen("E:/project/collegeinfo.txt","rb+"); printf("\t\t\n\n\n\n"); printf("\t\t****************COLLAGE INFORMATION********************"); printf("\t\t\n\n\n\n"); while(fread(&inf,sizeof(inf),1,fptr)==1) for(i=0;i<=80;i++) printf("-"); printf("\n"); { printf("%s",inf.info); } printf("\n"); for(j=0;j<=80;j++) printf("-"); getch(); } void addbuschedule() { system("cls"); fptr=fopen("E:/project/businfo.txt","ab+"); while(1) { printf("\nEnter bus no: "); scanf("%s",&b.busno); printf("\nEnter phone no: "); scanf("%s[^\n]",&b.phone); printf("\nEnter bus stops and time"); scanf("%s[^\n]",&b.stop); fwrite(&b,sizeof(b),1,fptr); fflush(stdin); printf("\nRecord sucessfully added"); printf("Press ESC key to exit or another key to continue"); char t; t=getch(); if(t==27) exit(1); } fclose(fptr); } void searchbusinfo() { system("cls"); fptr=fopen("E:/project/businfo.txt","rb+"); printf("\n\n\t\t********************BUS INFORMATION*******************\n"); while(fread(&b,sizeof(b),1,fptr)==1) { for(i=0;i<=70;i++) printf("-"); printf("\nBus no: %s\nphone no: %s\nBus stops and time: %s",b.busno,b.phone,b.stop); for(j=0;j<=70;j++) printf("-"); } fclose(fptr); getch(); } void editclassroutine() { char d[10]; int found=0; printf("Enter day to modify"); scanf("%s",&d); fptr=fopen("E:/project/classroutine.txt","rb+"); while(fread(&r,sizeof(r),1,fptr)==1) { if(strcmp(r.day,d)==0) { printf("record found"); printf("\n enter day:"); scanf("%s[^\n]",&r.day); fflush(stdin); printf("\n Enter 1st period:"); scanf("%s[^\n]",&r.one); printf("\n Enter 2nd period:"); scanf("%s[^\n]",&r.two); printf("\n Enter 3rd period:"); scanf("%s[^\n]",&r.three); printf("\n Enter 4th period:"); scanf("%s[^\n]",&r.four); printf("\n Enter 5th period:"); scanf("%s[^\n]",&r.five); printf("\n Enter 6th period:"); scanf("%s",&r.sic); fseek(fptr,-sizeof(r),SEEK_CUR); fwrite(&r,sizeof(r),1,fptr); break; } } fclose(fptr); } void editbusinfo() { char d[20]; int found=0; printf("Enter bus no"); scanf("%s",&d); fptr=fopen("E:/project/businfo.txt","rb+"); while(fread(&b,sizeof(b),1,fptr)==1) { if(strcmp(b.busno,d)==0) { printf("record found"); printf("\nEnter bus no: "); scanf("%s",&b.busno); printf("\nEnter phone no: "); scanf("%s[^\n]",&b.phone); printf("\nEnter bus stops and time"); scanf("%s[^\n]",&b.stop); fseek(fptr,-sizeof(b),SEEK_CUR); fwrite(&b,sizeof(b),1,fptr); break; } } fclose(fptr); } void editeacherinfo() { char d[20]; int found=0; printf("Enter teachers name to be modified"); scanf("%s",&d); fptr=fopen("E:/project/teacherinfo.txt","rb+"); while(fread(&t,sizeof(t),1,fptr)==1) { if(strcmp(t.name,d)==0) { printf("record found"); printf("\nEnter teachers full name\n"); scanf("%s[^\n]",&t.name); printf("\nenter qaualificaton\n "); scanf("\n%s[^\n]",&t.qualify); printf("\nenter phone no "); scanf("\n%s[^\n]",&t.phone); printf("\nenter desination"); scanf("\n%s[^\n]",&t.design); fseek(fptr,-sizeof(t),SEEK_CUR); fwrite(&t,sizeof(t),1,fptr); break; } } fclose(fptr); } void deleteclassroutine() { FILE *temp; char d[13]; fptr=fopen("E:/project/classroutine.txt","rb"); if(fptr==NULL) { printf("error in opening main file"); exit(1); temp=fopen("tempfile.txt","wb"); if(temp==NULL) { printf("\nerror in opening file"); exit(1); } printf("\nenter name of day to delete"); scanf("%s[^\n]",&d); while(fread(&r,sizeof(r),1,fptr)==1) { if(strcmp(r.day,d)==0) { printf("record found"); continue; } else fwrite(&r,sizeof(r),1,temp); } fclose(fptr); fclose(temp); remove("E:/project/classroutine.txt"); rename("tempfile.txt","classroutine.txt"); printf("\nrecord sucesspully deleted"); } } void deleteteacherinfo() { system("cls"); FILE *temp; char dt[13]; fptr=fopen("E:/project/teacherinfo.txt","rb"); if(fptr==NULL) { printf("error in opening main file"); exit(1); } temp=fopen("tempfile.txt","wb"); if(temp==NULL) { printf("\nerror in opening file"); exit(1); } printf("\nenter name of teacher to delete"); scanf("%s[^\n]",&d); while(fread(&t,sizeof(t),1,fptr)==1) { if(strcmp(t.name,dt)==0) { printf("record foud"); continue; } else fwrite(&t,sizeof(t),1,temp); } fclose(fptr); fclose(temp); remove("E:/project/teacherinfo.txt"); rename("tempfile.txt","teacherinfo.txt"); printf("\nrecord sucesspully deleted"); } void deletebusinfo() { FILE *temp; char d[13]; fptr=fopen("E:/project/businfo.txt","rb"); if(fptr==NULL) { printf("error in opening main file"); exit(1); } temp=fopen("tempfile.txt","wb"); if(temp==NULL) { printf("\nerror in opening file"); exit(1); } printf("\nenter name of bus no to delete: "); scanf("%s[^\n]",&d); while(fread(&b,sizeof(b),1,fptr)==1) { if(strcmp(b.busno,d)==0) { printf("record foud"); continue; } else fwrite(&b,sizeof(b),1,temp); } fclose(fptr); fclose(temp); remove("E:/project/businfo.txt"); rename("tempfile.txt","businfo.txt"); printf("\nrecord sucesspully deleted"); } void searchclasschedule() { char de[35]; fptr=fopen("E:/project/classroutine.txt","rb+"); if(fptr==NULL) { printf("error"); getch(); } printf("enter name of day to search"); scanf("%s[^\n]",&de); while(fread(&r,sizeof(r),1,fptr)) { if(strcmp(r.day,de)==0) printf("\nrecord found\n"); system("cls"); printf(" 10:30-11:15 11:15-12 12-12:45 12:45-1:30 1:30-2:15 2:15-3 3-3:45 3:45-4:30"); for(i=0;i<79;i++) printf("-"); printf("\n%s %s %s %s %s %s",r.day,r.one,r.two,r.three,r.four,r.five,r.sic); printf("\n"); for(i=0;i<79;i++) printf("-"); break; } fclose(fptr); } void searbusschedule() { char dk[35]; fptr=fopen("E:/project/businfo.txt","rb+"); if(fptr==NULL) { printf("error"); getch(); } printf("enter name of bus no: "); scanf("%s[^\n]",&dk); while(fread(&b,sizeof(b),1,fptr)) { if(strcmp(r.day,dk)==0) printf("\nrecord found\n"); system("cls"); printf("\n\n\t\t********************BUS INFORMATION*******************\n"); for(i=0;i<=70;i++) printf("-"); printf("\nBus no: %s\nphone no: %s\nBus stops and time: %s\n",b.busno,b.phone,b.stop); for(j=0;j<=70;j++) printf("-"); break; } fclose(fptr); } void searteacherinfo() { char dm[35]; fptr=fopen("E:/project/teacherinfo.txt","rb+"); if(fptr==NULL) { printf("error"); getch(); } printf("enter name of teacher to search: "); scanf("%s[^\n]",&dm); while(fread(&t,sizeof(t),1,fptr)) { if(strcmp(t.name,dm)==0) printf("\nrecord found\n"); system("cls"); printf("\n\n\t\t********************TEACHER INFORMATION*******************\n"); for(i=0;i<=70;i++) printf("-"); printf("\nName: %s\n\nPhone no: %s\n\nQualification: %s\n\nDesination: %s\n",t.name,t.phone,t.qualify,t.design); for(j=0;j<=70;j++) printf("-"); break; } fclose(fptr); } |
Output Snapshot:
Â
Â