Answered! Can you help me to making C++ programming? Sort a 10×15 array of characters. Largest located at index [0][0-14] and smallest at index [9][0-14]….

Can you help me to making C++ programming?

Sort a 10x15 array of characters.  Largest located
at index [0][0-14] and smallest at index [9][0-14].  
Create a procedure that passes the array to a print routine, 
then a procedure that sorts the array and returns the sorted array 
to the original procedure, and finish by using the same print routine.  
Fill the array with


Lcekoeddhoffbmc
Lkcmggjcdhhglif
Cgldjhcekjigcde
Cgldjhcekjigcdz
Bffmdbkcenlafjk
Fggdijijegfblln
Jjlncnimjldfedj
Amliglfohajcdmm
Balgfcaelhfkgeb
Kmlhmhcddfoeild


Note:  This is a character array but the sorting is 
done as if there are 10 strings with each string having 15 characters.  
The output would be


Lkcmggjcdhhglif
Lcekoeddhoffbmc
Kmlhmhcddfoeild
Jjlncnimjldfedj
Fggdijijegfblln
Cgldjhcekjigcdz
Cgldjhcekjigcde
Bffmdbkcenlafjk
Balgfcaelhfkgeb
Amliglfohajcdmm

Full credit will be given if a file is used to read in the array.
Name the file input.dat

Expert Answer

 #include<iostream>

#include<fstream>
#include<cstring>
using namespace std;
void print(char array[][16], int rows, int cols){
for(int i=0; i<rows; i++){
for(int j=0; j<cols; j++)
cout << array[i][j];
cout << endl;
}
}
void Sort(char array[][16], int rows, int cols){
char temp[16];
for(int i=0; i<rows; i++){
for(int j=i+1; j<rows; j++)
if(strcmp(array[i], array[j])<0){
strcpy(temp, array[i]);
strcpy(array[i], array[j]);
strcpy(array[j], temp);
}
}
}
int main(){
ifstream infile(“input.dat”);
char array[10][16];
int i=0;
if(!infile){
cout <<“unable to open file so exiting from program”<<endl;
return 0;
}
while(!infile.eof()){
infile >> array[i++];
}
cout << “Before Sorting ” << endl;
print(array, 10, 15);
Sort(array, 10, 15);
cout << “nAfter Sorting ” << endl;
print(array, 10, 15);
return 0;
}

Still stressed from student homework?
Get quality assistance from academic writers!