Question: C + + Change the WEEK - 4 program to work through the gradesBook class. #include #include using namespace std; void sort ( char nm

C++
Change the WEEK-4 program to work through the gradesBook class.
#include
#include
using namespace std;
void sort(char nm[][10]);
void display(char name[][10]);
int main(){
char names[10][10];
int i;
for (i=0; i<10; i++)
{
cout << "Enter name of the student : ";
cin >> names[i];
}
sort(names);
display(names);
return 0;
}
void sort(char nm[][10]){
char temp[10];
cout <<"Sorting names in Ascending Order "<< endl;
for (int i =0; i <10; ++i)
for (int j =i+1; j<10; j++)
{
if (strcmp(nm[i],nm[j])>0)
{
strcpy(temp,nm[i]);
strcpy(nm[i],nm[j]);
strcpy(nm[j],temp);
}
}
};
void display(char nm[][10])
{
cout <<"Displaying names in Ascending Order "<< endl;
for (int i =0; i <10; ++i)
{
cout<< nm[i]<<""

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!