Hi, I need help with my school work on C++. I have an already working code but my instructor told me to sort the structure elements which I have no idea how to do. Hoping someone can help me, here is my code below
#include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
#include <string.h>
#include <sstream>
#include <stdlib.h>
using namespace std;
#define SIZE 100
struct employee
{
char name[30];
char enumber[30];
char salary[30];
char address[50];
char job[50];
float balance;
void Sort(void);
void InputDetail(void);
void OutputDetail(void);
};
void employee::InputDetail(void){
cout << "Enter Employee Name: ";
cin >> name;
cout << "Enter Employee Number: ";
cin >> enumber;
cout << "Enter Employee Address: ";
cin >> address;
cout << "Enter Job Designation: ";
cin >> job;
cout << "Enter Basic Salary: ";
cin >> salary;
}
void employee::OutputDetail(void){
cout << "Employee details:\n";
cout << "Name: "<< name <<endl;
cout << "Employee Number: " << enumber << endl;
cout << "Employee Address: " << address << endl;
cout << "Job Designation: " << job << endl;
cout << "Basic Salary: " << salary << endl;
}
int main() //start of program
{
employee std[SIZE];
int x,loop;
cout << "Enter total number of employees: ";
cin >> x;
for(loop=0; loop<x; loop++){
cout << "Enter details of employees " << loop+1 << ":\n";
std[loop].InputDetail();
}
cout << endl;
printf("\nUnsorted List: \n");
for(loop=0; loop<x; loop++){
cout << "Details of employees " << loop+1 << ":\n";
std[loop].OutputDetail();
}
cout << endl;
printf("\nSorted List: \n");
for(loop=0; loop<x; loop++){
cout << "Details of employees " << loop+1 << ":\n";
}
return 0;
}