Make one program using Dev C++, and explain how it works
Final Program Requirements
Program is a database of complex information, e.g. Students, Employees, etc.
Program shows a selection screen that allows the user to add an entry to the database, display entries, remove an entry, edit an entry, or search an entry using a particular parameter, e.g. ID number, name, etc.
Program has support for a maximum of 10 data set.
Program shows the selection screen again after an operation.
Program searches for entries using Linear Search Algorithm.
Test Walkthrough
1. Prior to checking of the lab instructor, enter at least 4 dummy data in the database.
2. Display the entered data.
3. Remove an entry from the database.
4. Add an entry to the database.
5. Edit the first entry of the database.
6. Enter an invalid choice at the selection screen.
7. Quit the program.
main.cpp
#include<iostream>
#include<stdio.h>
using namespace std;
struct student //structure for student
{
int ID;
string name;
int age;
}s[10]; //global declaration of student array
int menu() //for displaying the menu
{
cout<<"Press 1 for adding a student's details in the
database\n";
cout<<"Press 2 for displaying all the students'
details\n";
cout<<"Press 3 for deleting a student's record\n";
cout<<"Press 4 for editing a student's record\n";
cout<<"Press 5 for exiting the program\n";
cout<<"Enter your choice : ";
int ch;
cin>>ch; //user entering choice
cout<<endl;
return ch; //returning choice
}
void addStudent(int &n) //function for adding a student to
database
{
cout<<"Enter student's ID : ";
cin>>s[n].ID;
cout<<"Enter student's name : ";
cin>>s[n].name;
cout<<"Enter student's age : ";
cin>>s[n].age;
cout<<endl;
n++; //incrementing n
}
void display(int n) //function for displaying the student
records
{
if(n==0) //if n=0, then there are no records to display
{
cout<<"No students to display\n\n";
return;
}
for(int i=0;i<n;i++) //displaying student records one by
one
{
cout<<"Student "<<i+1<<" ID : ";
cout<<s[i].ID<<endl;
cout<<"Student "<<i+1<<" name : ";
cout<<s[i].name<<endl;
cout<<"Student "<<i+1<<" age : ";
cout<<s[i].age<<endl<<endl;
}
cout<<endl;
}
void delStudent(int &n) //function for deleting a student
record
{
if(n==0) //if n=0, there are no records to delete
{
cout<<"There are no student records to be deleted\n\n";
return;
}
int id; //for storing id of student to be deleted
cout<<"Enter the ID of student to be deleted : ";
cin>>id;
int ind = -1; //initialising ind as -1
for(int i=0;i<n;i++) //iterating through array to compare this
id with every id
{
if(s[i].ID==id) //if this id = given id, then making ind=i
{
ind=i;
break;
}
}
if(ind==-1) //if id=-1, then there is no student with given
id
{
cout<<"No student with this ID exists\n";
return;
}
for(int i=ind;i<n-1;i++) //shifting each record after index ind
(one index up)
{
s[i].ID=s[i+1].ID;
s[i].name=s[i+1].name;
s[i].age=s[i+1].age;
}
n--; //decrementing n
}
void editStudent(int n) //function for editing a record
{
if(n==0) //if n=0, then there are no students to edit
{
cout<<"No students to edit\n\n";
return;
}
int id; //for storing id of student to be edited
cout<<"Enter the ID of student to be edited : ";
cin>>id;
int ind=-1; //initialising ind as -1
for(int i=0;i<n;i++) //iterating through array to compare this
id with every id
{
if(s[i].ID==id) //if this student's id = id
{
ind=i; //making ind=i
//user entering new details
cout<<"Enter new ID : ";
cin>>s[i].ID;
cout<<"Enter new name : ";
cin>>s[i].name;
cout<<"Enter new age : ";
cin>>s[i].age;
break;
}
}
if(ind==-1) //if ind=-1, then there is no student with this
id
cout<<"No student with this ID exists\n";
}
int main()
{
int n=0,ch;
do
{
ch=menu(); //displaying menu
switch(ch)
{
case 1 : addStudent(n); //if ch=1, then adding a student
break;
case 2 : display(n); //if ch=2, then displaying a student
break;
case 3 : delStudent(n); // if ch=3, then deleting a student
break;
case 4 : editStudent(n); //if ch=4, then editing a student
break;
case 5 : return 0; //if ch=5, then exiting the program
}
}while(ch!=5);
}


Make one program using Dev C++, and explain how it works Final Program Requirements Program...