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

# include using namespace std;//Write a function to return a string composed of

ID: 3576999 • Letter: #

Question

# include using namespace std;//Write a function to return a string composed of the most//frequent lowercase letter found in each row of a 10 times 10//array of lowercase alphabetic chars in the range a through z////If there is more than one most frequent character, use the//one that come first alphabetically.////Also, for no apparent reason associated with this problem, //review the definition of a latin square.//use neither cin nor cout//TODO: write all your below this line string mostFrequent(char c[10] [10]) {}//TODO: write all your above this line int main(){char c[10][10] = {'a', 'b', 'f', 'd', 'e', 'f', 'g' 'h', 'I', 'j', a', 'b', 'c', 'r', 'c', 'r', 'g' 'h', 'r', 'j' a', 'b', 'c', 'd', 'e', 'f', 'g' 'h', 'o', 'o', 'z', 'w', 'p', 'd', 'e', 'f', 'g', 'h', 'I', 'j', 'o', 'd', 'o', 'd', 'o', 'b', 'o' 'd', 'o', 'd' 'a', 'l', 'l', 'd', 'e', 'f', 'f', 'h', 'l', 'j'. 'a', 'b', 'c', 'd', 'i', 'f', 'g', 'h', 'I', 'j'. 'a', 'b', 'z', 'v', 'z', 'v', 'g', 'g', 'v', 'z'. 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'v', 'z', 'a', 'b', 's', 'd', 'e', 'f', 'g', 'h', 's', 'j', ); cout

Explanation / Answer

Solution for the problem :-

#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
string mostFrequent(char c[10][10])
{
int i,j,count[26]={0},k=0,m=0,l,n,x;
char in[100],small,sm[100];
for(i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
count[c[i][j]-'a']++;
if((count[c[i][j]-'a'])>1)
{
in[k]=c[i][j];
k++;
n=k;

}
}
for(j=0;j<10;j++)
{
count[c[i][j]-'a']=0;
}

k=0;
small=in[k];
if(n==1)
{
sm[m]=small;
m++;
x=m;
}
if(n>1)
{
for(l=0;l<n-1;l++)
{
if(in[l+1]<small)
{
small=in[l+1];
}
}
sm[m]=small;
m++;
x=m;
}
in[0]=' ';

}
return sm;
}
int main()
{
char c[10][10]={
'a','b','f','d','e','f','g','h','i','j',
'a','b','c','r','c','r','g','h','r','j',
'a','b','c','d','e','f','g','h','o','o',
'z','w','p','d','e','f','g','h','i','j',
'o','d','o','d','o','b','o','d','o','d',
'a','l','l','d','e','f','f','h','l','j',
'a','b','c','d','i','f','g','h','i','j',
'a','b','z','v','z','v','g','g','v','z',
'a','b','c','d','e','f','g','h','i','e',
'a','b','s','d','e','f','g','h','s','j'};
cout<<mostFrequent(c);
return 0;
}

OUTPUT :-

fco dfiges

Note :- In line number 4 their are no frequent charecters thats why their is a space if you want to remove that replace line    in[0]=' '; in   string mostFrequent(char c[10][10]) function.

Thank you!