#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.

user will be able to insert the detail of the student and insert it into array. The Maximum size of array set to 100. If the maximum size reached, the system should inform the user.

user will be able to delete the record by inserting the student ID, the particular record will be removed from the array.

user will be able to sort the record according by selecting student name or student ID

user will be able to display all record in the array to screen.

what you need to do is write a switch statement in main() that will process each of the menu options. For example if the user selects option #1 you do not want to make him also do the other options.

After that last cout in main() you need to add something like the following

int answer;
cin >> answer;
switch(answer)
{
    case 1: // insert new record
        InsertNewRecord(array); // you will have to add this function
        break;
   // now do this for each of the other options
}

You might want to change some part of the student to
accommodate strings. For example, a name should be a std::string
instead of a char.

struct student
{
  int ID;
  char name;
  char nationality;
  char gender;
};

To use the keyword delete, for your array, you have to dynamically
allocate memory. Since you are not doing that you can do
some other things. One that comes to mind is delete all
data by assigning them 0 and/or "".

To sort the members you can use std::sort, with your own compare
function.

okay tnx but pls how can i create an array that can sort?

The array you created can be sorted. There are more efficient ways to do it, but what you did is ok. Google for "bubble sort" to get the algorithm for that one, which is the easiest to code.

And, as previously mentioned, you will have to change that structure, because it needs to contain strings for name, geneder and nationality. What you have will only hold a single character

struct student
{
  int ID;
  std::string name;
  std::string nationality;
  std::string gender;
};

If you are required to use character arrays instead of std::string you could do it like this too:

struct student
{
  int ID;
  char name[80];
  char nationality[80];
  char gender[2]; // either 'M' or 'F'
};

guys how can i sort for two variable and i don't understand the explanation about the delete?

If you have a static array, such as struct students std[200]; then to delete on of the students you a couple choides

1) just reset the ID and other variables to some default value (such as 0). Then when searching just bypass any arrays whose id value is 0.

2) Move all the structures up one slot to fill up the structure you want deleted. For instance if there are 10 structures in the array and you want to delete #5, then move 6-10 up one to 5-9 and set the 10th one to default values, such as 0 or "" string.

If you use a vector instead of the above all you have to do is call the vector's erase() method.

This question has already been answered. Start a new discussion instead.