Question: using C++ finish and alter the code, to sort the anagram to which is to be ordered by their count (meaning the highest number of
using C++ finish and alter the code, to sort the anagram to which is to be ordered by their count (meaning the highest number of the alphabets in each letter/character is to be outputted/printed first) You may alter (add/remove/alter the part of the code) where it says 'code here'
#include
#include
using namespace std;
#define SIZE 25
string sortChar(string str)
{
int i, key, j;
int n = str.length();
//for (i = 0; i
for (i = 0; i
for (j = 0; j
/* CODE HERE */
if(str[j] > str[j+1]) {
key = str[j];
str[j] = str[j+1];
str[j+1] = key;
}
}
}
return str;
}
void sortString(string strArray[])
{
int i, j;
for (i = 0; i
/* CODE HERE */
string temp;
for (j = 0; j
/* CODE HERE */
}
}
}
void printStringArray(string strArray[])
{
for (int i = 0; i
cout
}
}
int main()
{
string strArray[] = {"alert", "cares", "cautioned", "marine","acres",
"slaw", "education", "dear", "airmen", "awls",
"asp", "auctioned", "ear", "later", "fairy tales",
"races", "laws", "pas", "remain", "sap",
"are", "dare", "read", "alter", "rail safety"};
cout > "
printStringArray(strArray);
cout
sortString(strArray);
cout > "
printStringArray(strArray);
cout
return 0;
}

What output should look like - Check the link in the comment
#include #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
