Write a C program to sort your name without space in uppercase characters in descending order (Z to A) by using the insertion sort algorithm. The program should: a) Take input of your name in all capital letters then remove the space. b) Print the name without space. c) Sort the alphabets using insertion sort d) Print the sorted array In order to achieve the above objectives, your program should consist of the following functions: a) A function called takeNameRemoveSpace to take in a string of your name with space and return the array of characters without space. b) A function called printArray to print out the contents of an array. c) A function called insertionSort that carries out the insertion sort algorithm in descending order. An example of the output is shown in Figure 3. Input: MOHAMAD YUSOFF BIN ALIAS Before: MOHAMADYUSOFFBINALIAS After: YUSSOONMMLIIHFFDBAAAA

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 23PE
icon
Related questions
Question
Write a C program to sort your name without space in uppercase characters in descending
order (Z to A) by using the insertion sort algorithm.
The program should:
a) Take input of your name in all capital letters then remove the space.
b) Print the name without space.
c) Sort the alphabets using insertion sort
d) Print the sorted array
In order to achieve the above objectives, your program should consist of the following
functions:
a) A function called takeNameRemoveSpace to take in a string of your name with
space and return the array of characters without space.
b) A function called printArray to print out the contents of an array.
c) A function called insertionSort that carries out the insertion sort algorithm in
descending order.
An example of the output is shown in Figure 3.
Input: MOHAMAD YUSOFF BIN ALIAS
Before: MOHAMADYUSOFFBINALIAS
After: YUSSOONMMLIIHFFDBAAAA
Figure 3
Transcribed Image Text:Write a C program to sort your name without space in uppercase characters in descending order (Z to A) by using the insertion sort algorithm. The program should: a) Take input of your name in all capital letters then remove the space. b) Print the name without space. c) Sort the alphabets using insertion sort d) Print the sorted array In order to achieve the above objectives, your program should consist of the following functions: a) A function called takeNameRemoveSpace to take in a string of your name with space and return the array of characters without space. b) A function called printArray to print out the contents of an array. c) A function called insertionSort that carries out the insertion sort algorithm in descending order. An example of the output is shown in Figure 3. Input: MOHAMAD YUSOFF BIN ALIAS Before: MOHAMADYUSOFFBINALIAS After: YUSSOONMMLIIHFFDBAAAA Figure 3
Expert Solution
steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr