#include <iostream>
using namespace std;
struct student
{
int ID;
char name;
char nationality;
char gender;
};
void record(student array[]);
int main()
{
cout <<"Welcome to student recording system"<<endl;
cout <<"Please choose one of the following option"<<endl;
cout <<"1.Insert new record"<<endl;
cout <<"2.Delete record"<<endl;
cout <<"3.Sort record"<<endl;
cout <<"4.Display record"<<endl;
student array[100];
record(array);
return 0;
}
void record(student array[])
{
for(int i=0;i<100;i++)
{
cout <<"Enter student ID:"<<endl;
cin >>array[i].ID;
cin.ignore(100,'\n');
cout <<"Enter student name:"<<endl;
cin >>array[i].name;
cin.ignore(100,'\n');
cout <<"Enter student nationality:"<<endl;
cin >>array[i].nationality;
cin.ignore(100,'\n');
cout <<"Enter student gender:"<<endl;
cin >>array[i].gender;
cin.ignore(100,'\n');
}
}
Delete record
In the delete record function, user able to delete the record by inserting the student ID, the particular record will be removed from the array.
Sort record
In the sorting function, user able to sort the record according by selecting student name or student ID
Display record
In this function, user will able to display all record in the array to screen.