CAL-C
Project Report C++
Student Database Management System Submitted to: Submitted by: Mr/Miss :-
Miss:- Shilpa Roll.
No:- 1010270441 ClassPGDCA
ACKNOWLEDGEMENT I
take
this
opportunity
to
express
my
gratitu titud de to our guide and lab incharge who encourage me with her critical and constructive suggestions in the project work. I am also thankful to my guide MY MAM for her valuable guidance in this project successfully. She benefited me with her experience skill in the project. I again thank to all for their eir support and encouragement.
INTRODUCTION C++ programming helps us in finding the the sol solution of the problems by the computer language, by preparing the C++ program codes. As same in this program of the address book we have given a statement in the execution screen to enter the address of the employee or any personal address. In thi this program I used structures and if-else loops with the help of switch case and for loops.
This program helps us to do many further aspects in the future.
System Requirements:-For this program this system requires following things:-1.
First of all we require C software….
2. Then Then we re requir quire e 32 32 bit bit scr screen een resolution…. 3. Then Then we re requir quire e Com Compi pile lerr…. 4. We also lso req requ uire ire wi window ndow Xp…. p….
Introduction of Student database management system We can make this student database management system in C++ language by using three or more than three header files or many data types such as: 1. #include #include : this header file will contain cout() , cin () And,
there are many header files which are used us ed in this program…. 2. #include: this header file will contain Clrscr(); , Getch(); , and
many more…..
3. #include: this header file will contain power
function(pow()) , squareroots function , cuberoots function , etc are used in this program… 4. #include : this header file will contain string
function such as : a.
Strrev();
b.
Strlen();
c.
Strupr() ;
d.
Strlwr() ;
e.
And many mores……
Source code // Student Information System #include #include #include #include
#include #include
main () { FILE *fp, *ft; Char another, choice;
struct student { char first_name [50], last_name[50]; char course[100]; int section; };
struct student e; char xfirst_name[50], xfirst_name[50], xlast_name[50]; xlast_name[50]; long int recsize;
fp=fopen("users.txt","rb+");
if (fp == NULL) { fp = fopen("users.txt","wb+");
if (fp==NULL) { puts("Cannot open file"); return 0; } }
recsize = sizeof(e);
while(1) { system("cls"); clrscr();
Cout << "\t\t======= STUDENT INFORMATION SYSTEM ========"; cout <<"\n\n Created By:-Shilpa By:-Shil pa choudhary,For-:PGDCA"; choudhary,F or-:PGDCA"; cout << "\n\n"; cout << "\n \t\t\t 1. Add
Records";
cout << "\n \t\t\t 2. List Records"; cout << "\n \t\t\t 3. Modify Records"; cout << "\n \t\t\t 4. Delete Records"; cout << "\n \t\t\t 5. Exit Program"; cout << "\n\n"; cout << "\t\t\t Select Your Choice :=> "; fflush(stdin); choice = getche(); switch(choice) { case '1' : fseek(fp,0,SEEK_END); another ='Y';
while(another == 'Y' || another == 'y') { system("cls"); cout << "Enter the Firt Name : "; cin >> e.first_name; cout << "Enter the Last Name : "; cin >> e.last_name; cout << "Enter the Course
: ";
cin >> e.course; cout << "Enter the Section : "; cin >> e.section; fwrite(&e,recsize,1,fp); cout << "\n Add Another Record (Y/N) "; fflush(stdin); another = getchar(); } break; case '2':
system("cls"); rewind(fp); cout << "=== View the Records in the Database ==="; cout << "\n"; while (fread(&e,recsize,1,fp) == 1){ cout << "\n"; cout<<"\n" << e.first_name e.first_name << setw(10) setw(10) << e.last_name; cout << "\n"; cout <<"\n" <
case '3' : system("cls");
another = 'Y'; while (another == 'Y'|| another == 'y') { cout << "\n Enter the last name of the student : "; cin >> xlast_name;
rewind(fp); while (fread(&e,recsize,1,fp) (fread(&e,recsize,1,fp) == 1) { if (strcmp(e.last_name,xlast_name) == 0) { cout << "Enter new the First Name : "; cin >> e.first_name; cout << "Enter new the Last Name : "; cin >> e.last_name; cout << "Enter new the Course
: ";
cin >> e.course; cout << "Enter new the Section : ";
cin >> e.section; fseek(fp, - recsize, SEEK_CUR); fwrite(&e,recsize,1,fp); break; } } cout << "\n Modify Another Record (Y/N) "; fflush(stdin); another = getchar(); } break;
case '4': system("cls"); another = 'Y'; while (another == 'Y'|| another == 'y') {
cout << "\n Enter the last name of the student to delete : "; cin >> xlast_name;
ft = fopen("temp.dat", "wb");
rewind(fp); while (fread (&e, recsize,1,fp) == 1)
if (strcmp(e.last_name,xlast_name) != 0) { fwrite(&e,recsize,1,ft); } fclose(fp); fclose(ft); remove("users.txt"); rename("temp.dat","users.txt");
fp=fopen("users.txt","rb+");
cout << "\n Delete Another Record (Y/N) "; fflush(stdin); another = getchar(); }
break;
case '5': // Student Information Information System #include #include #include #include #include #include
main() {
FILE *fp, *ft; char another, choice;
struct student { char first_name[50], last_name[50]; char course[100]; int section; };
struct student e; char xfirst_name[50], xfirst_name[50], xlast_name[50]; xlast_name[50]; long int recsize;
fp=fopen("users.txt","rb+");
if (fp == NULL) { fp = fopen("users.txt","wb+");
if (fp==NULL) { puts("Cannot open file"); return 0; } recsize = sizeof(e); while(1) { system("cls"); clrscr(); cout << "\t\t======= STUDENT INFORMATION SYSTEM ========"; cout <<"\n\n Created By:-Shilpa By:-Shil pa choudhary,For-:PGDCA"; choudhary,F or-:PGDCA"; cout << "\n\n"; cout << "\n \t\t\t 1. Add
Records";
cout << "\n \t\t\t 2. List Records"; cout << "\n \t\t\t 3. Modify Records"; cout << "\n \t\t\t 4. Delete Records"; cout << "\n \t\t\t 5. Exit Program";
cout << "\n\n"; cout << "\t\t\t Select Your Choice :=> "; fflush(stdin); choice = getche(); switch(choice) { case '1' : fseek(fp,0,SEEK_END); another ='Y'; while(another == 'Y' || another == 'y') { system("cls"); cout << "Enter the Firt Name : "; cin >> e.first_name; cout << "Enter the Last Name : "; cin >> e.last_name; cout << "Enter the Course cin >> e.course;
: ";
cout << "Enter the Section : "; cin >> e.section; fwrite(&e,recsize,1,fp); cout << "\n Add Another Record (Y/N) "; fflush(stdin); another = getchar(); } break; case '2': system("cls"); rewind(fp); cout << "=== View the Records in the Database ==="; cout << "\n"; while (fread(&e,recsize,1,fp) == 1) {6fyy536ujh5u6786fyy536ujh5u 6fyy536ujh5u6786fyy536ujh5u67867u cout << "\n";
cout <<"\n" << e.first_name << setw(10) << e.last_name; cout << "\n"; cout <<"\n" <
case '3' : system("cls"); another = 'Y'; while (another == 'Y'|| another == 'y') { cout << "\n Enter the last name of the student : "; cin >> xlast_name; rewind(fp); while (fread(&e,recsize,1,fp) (fread(&e,recsize,1,fp) == 1)
{ if (strcmp(e.last_name,xlast_name) == 0) { cout << "Enter new the Firt Name : "; cin >> e.first_name; cout << "Enter new the Last Name : "; cin >> e.last_name; cout << "Enter new the Course
: ";
cin >> e.course; cout << "Enter new the Section : "; cin >> e.section; fseek(fp, - recsize, SEEK_CUR); fwrite(&e,recsize,1,fp); break; } } cout << "\n Modify Another Record (Y/N) "; fflush(stdin);
another = getchar(); } break;
case '4': system("cls"); another = 'Y'; while (another == 'Y'|| another == 'y') { cout << "\n Enter the last name of the student to delete : "; cin >> xlast_name;
ft = fopen("temp.dat", "wb");
rewind(fp); while (fread (&e, recsize,1,fp) == 1)
if (strcmp(e.last_name,xlast_name) != 0) { fwrite(&e,recsize,1,ft); } fclose(fp); fclose(ft); remove("users.txt"); rename("temp.dat","users.txt");
fp=fopen("users.txt","rb+");
cout << "\n Delete Anot fclose(fp); cout << "\n\n"; cout << "\t\t cout << "\n\n"; exit(0); }
THANK YOU FOR USING THIS SOFTWARE";
} system("pause"); }