Below is this code ive written for an assignment. The program simply takes in data for a variety of students and performs a variety of tasks on the data. For some reason the ascending order function isnt working right. Ive double, triple checked the code but cant seem to find whats wrong. It would be really helpful if somebody could point out what im doing wrong.
The ascending order function is simply taking the values from a dynamic array and setting them in ascending order in a newly created dynamic array.
The students are represented in ascending order according to their roll numbers.
void Student::inputValues()
{
cout<<"Please enter the students full name, semester number, module number, roll number, subject 1, and subject 2. Please keep your entries to within ten characters."<<endl;
for(int a=0; a<students; a++)
{ cout<<"Student "<<a+1<<": "<<endl;
for(int b=0; b<6; b++)
{
getline(cin,ptr[a][b]); } cout<<endl; } cout<<endl;
}
void Student::removeStudent(const Student& temp)
{ int a,b=0; string c;
students=temp.students;
cout<<"Enter the roll number of the student you want removed."<<endl;
cin>>c;
Student& Student::operator = (const Student& temp)
{ int b=0;
cout<<"Do you want to remove a student from the list or add a student. 1. Add, 2. Remove"<<endl;
cin>>b;
cout<<"Please enter the students full name, semester number, module number, roll number, subject 1, and subject 2. Please keep your entries to within ten characters."<<endl;
cout<<"Student "<<c+1<<": "<<endl;
for(int b=0; b<6; b++)
{
getline(cin,ptr[c][b]); } cout<<endl;
}