Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is the .txt file Lbfkoeddhoffbmg Lkcmggjcdhhglif Cgldjhcekjigcdd Cgldjhcekj

ID: 3548596 • Letter: T

Question

This is the .txt file

Lbfkoeddhoffbmg

Lkcmggjcdhhglif

Cgldjhcekjigcdd

Cgldjhcekjigcdn

Bffmdbkcenlafjk

Fggdijijegfblln

Jjlncnimjldfedj

Amliglfohajcdmm

Balgfcaelhfkgeb

Kmlhmhcdcfoeilc


Sort a single column array and/or sort a 2 dimensional array

of characters given any column. Here is what I used as my

template specification.


//This class sorts arrays either ascending or descending

template<class T>

class Prob2Sort

{

private:

int *index; //Index that is utilized in the sort

public:

Prob2Sort(){index=NULL;}; //Constructor

~Prob2Sort(){delete []index;}; //Destructor

T * sortArray(const T*,int,bool); //Sorts a single column array

T * sortArray(const T*,int,int,int,bool); //Sorts a 2 dimensional array

};


Driver program for the above class

cout<<"The start of Problem 2, the sorting problem"<<endl;

Prob2Sort<char> rc;

bool ascending=true;

ifstream infile;

infile.open("Problem2.txt",ios::in);

char *ch2=new char[10*16];

char *ch2p=ch2;

while(infile.get(*ch2)){cout<<*ch2;ch2++;}

infile.close();

cout<<endl;

cout<<"Sorting on which column"<<endl;

int column;

cin>>column;

char *zc=rc.sortArray(ch2p,10,16,column,ascending);

for(int i=0;i<10;i++)

{

for(int j=0;j<16;j++)

{

cout<<zc[i*16+j];

}

}

delete []zc;

cout<<endl;


The output from this problem.


The start of Problem 2, the sorting problem

Lbekoeddhoffbmg

Lkcmggjcdhhglif

Cgldjhcekjigcdd

Cgldjhcekjigcdn

Bffmdbkcenlafjk

Fggdijijegfblln

Jjlncnimjldfedj

Amliglfohajcdmm

Balgfcaelhfkgeb

Kmlhmhcddfoeilc


Sorting on column 15

Cgldjhcekjigcdn

Fggdijijegfblln

Amliglfohajcdmm

Bffmdbkcenlafjk

Jjlncnimjldfedj

Lbekoeddhoffbmg

Lkcmggjcdhhglif

Cgldjhcekjigcdd

Kmlhmhcddfoeilc

Balgfcaelhfkgeb

Explanation / Answer

very less time is left and i am still solving this problem.. I will post the link to the code in the comments below if I successfully code. Thanks.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote