Question: can someone help and explain this to me .. // step 1:Write a function that reads a sentence from the keyboard (2 pts) // step
can someone help and explain this to me ..
// step 1:Write a function that reads a sentence from the keyboard (2 pts)
// step 2:Find out the frequency of the alphabets in the sentence, ignore uppercase or lowercase in the sentence(8 pts)
int main(){
int count, i, j, k;
char sentence[MAXROWS];
char alphabets[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
int frequency[NUM_ALPHABETS];
for (i = 0; i < NUM_ALPHABETS; i++){
frequency[i] = 0;
}
// step 1:Write a function that reads a sentence from the keyboard (2 pts)
// step 2:Find out the frequency of the alphabets in the sentence, ignore uppercase or lowercase in the sentence(8 pts)
printf("%s%12s%15s ", "Alphabets", "Frequency", "Histogram");
for (j = 0; j < 26; j++){
printf("%8c %10d ", alphabets[j], frequency[j]);
for (k = 0; k < frequency[j]; k++)
printf("*");
printf(" ");
}
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
