Question
Use C++ to create a one-dimensional array to read 20 alphabetical letters (your program should be able to detect and print out an error message
Use C++ to create a one-dimensional array to read 20 alphabetical letters (your program should be able to detect and print out an error message if a non-alphabetical letter is entered). As each letter is entered, print a message saying ?duplicate letter? if the letter is already in the array. Write a function that can sort the array after all 20 letters have been entered. Write another function that print out the most frequent letter and number of times it was entered. Prepare for the case where all 20 letters are different, or all are the same.
Sample output:
Prince@Raji-PC /h/C-New/TSD/TSD_TP2_2017/week? Sa Enter 20 alphabets a is a duplicate letter. a is a duplicate letter. a is a duplicate letter. is a duplicate letter. a is a duplicate letter. a is a duplicate letter. a is a duplicate letter. a is a duplicate letter. is a duplicate letter. a is a duplicate letter. is a duplicate letter. a is a duplicate letter. is a duplicate letter. a is a duplicate letter. a is a duplicate letter. is a duplicate letter. a is a duplicate letter. a is a duplicate letter. a is a duplicate letter. The original array is: aaa The sorted array is: aaaaaaaaaaaaaaaaaaaa All characters are the sane. Prince@Raji-PC /h/C-New/TSD/TSD TP2_2017/week? a Enter 20 alphabets a 3 3 is not an alphabet b C d e n n 0 p 37804 P t The original array is: abcdefghijklmnopqrst The sorted array is: abcdefghijklmnopqrst All characters are entered only one time. Prince@Raji-PC /h/C-New/TSD/TSD_TP2_2017/week? $a Enter 20 alphabets a b is a duplicate letter. 4 is not an alphabet is not an alphabet d is a duplicate letter. d d is a duplicate letter. d is a duplicate letter. d is a duplicate letter. d d is a duplicate letter. f is a duplicate letter. 9 h d is a duplicate letter. d d is a duplicate letter. is a duplicate letter. d is a duplicate letter. f is a duplicate letter. The original array is: abaddddf ddf ghrddredf The sorted array is: aabdddddddddefffghrr The mode is 'd' and it is occuring 9 tines.
Step by Step Solution
3.39 Rating (152 Votes )
There are 3 Steps involved in it
Step: 1
include using namespace std void s...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started