Documentation:: Student Database Management System
Documentation:: Student Database Management System
S T U D E N T D ATA B A S E
MANAGEMENT SYSTEM
OUTLINES:
Procedure:
Requirements:
Structure:
Use of Array:
Functions:
1. Store all entered data:
2. Search by name:
3. Search by department:
4. Search by id:
5. Main function:
Loops:
Do-while:
Switch:
If else, nested if-else etc.:
Dry run:
PROCEDURE:
• First of all, analyze the problem, or the requirements of a user.
• Then, Thick about the possible solutions.
• Implement the most effective and efficient solutions.
• After that when we have decided the solutions and copy work of that problem.
• Start coding, During coding, our first priority is to make a structure in which
we will declare all those variables which we are going to use during the whole
program, because they have been declared globally in the Structure.
• Afterwards declare the Functions, which helped us during the program and
work more efficiently and neatly.
bool flag=true;
cout<<"DATA BASE OF |"<<dept<<"| DEPARTMENT"<<endl;
cout<<"ID"<<"\t"<<"NAME"<<"\t"<<"F Condition for comparing the
NAME"<<"\t"<<"DEPT"<<"\t"<<"ATTND"<<"\t"<<"FEE two departments:
STATUS"<<"\t"<<"C ATIVI"<<endl; 1.Which is entered by the user.
for(int i=0;i<ind;i++){ 2.Which is stored in the
if(s[i].std_department.compare(dept)==0) { database.
cout<<s[i].std_id<<"\t"<<s[i].std_name<<"\t"<<s[i].std_fathername<<"\t"
<<s[i].std_department<<"\t"<<s[i].std_attendance<<"\t"<<s[i].std_feestatu
s<<"\t \t "<<s[i].std_activities<<endl; If compiler found the same
ind++; department, it will print all the data
flag=false; of the department, such as students
name, quantity, f/name etc.
} }
if(flag)
{
cout<<"\n !!ERROR!!";
cout<<"\t\t\t\t-:WE HAVE NO INFO ABOUT THIS If user enters an invalid department
DEPARTMENT:-"<<endl;
Such as default case:
}
}
4.SEARCH BY ID:
void searchid(string id){ Definition of function:
if(ind==0){
cout<<"We are sorry !!"<<endl; First it will check the name, which you have
} entered, that either it is in our database or not
else{
bool flag=true;
for(int i=0;i<ind;i++) Condition for comparing the
{ if(s[i].std_id.compare(id)==0) two ids:
{ 1.Which is entered by the user.
cout<<" STUDENT DATA "<<endl; 2.Which is stored in the
cout<<"\nStudent Id | "<<s[i].std_id; database.
cout<<"\nStudent Name | "<<s[i].std_name;
cout<<"\nStudent F Name | "<<s[i].std_fathername;
cout<<"\nStudent Department | "<<s[i].std_department;
If compiler found the same
cout<<"\nStudent Attendance | "<<s[i].std_attendance; name; it will print all the related
cout<<"\nStudent Fee Status | "<<s[i].std_feestatus; data of that student which is
cout<<"\nStudent Activities | "<<s[i].std_activities; stored in that Specific array.
flag=false;
ind++; break;}
}
if(flag){
cout<<"Invalid id !! Try Again"<<endl;
}
}
Default case:
5.MAIN FUNCTION():
Main function is the most important function used in C++,This is the main body
of any program.
In which we can call thousands and unlimited functions of different type and
forms by simply calling them which we have declare and defined before the
main body.
• In this program, I’ve also used many functions.
• I’ve used a do while loop for the whole main body and inside that we used switch
statement and gave choice for multiple cases. i,e
• case 1: For entering data:
Case 2: Searching by name:
Case 3: Searching by department:
Case 4: Searching by ID:
Case 5: For exit program:
By the help of function call I’ve called the functions according to the cases and choices
which we’ve given before:
BODY OF MAIN FUNCTION( ):
GROUP MEMBERS:
• KHUZAIMA AYAZ
• TANIA TANVEER
• MASHAL KHALIL
• Muhammad FAIZAN