Question
Write a C language program that inputs ASCII characters and stores them in a character array until the enter key is hit (0x0D) or until
Write a C language program that inputs ASCII characters and stores them in a character array until the enter key is hit (0x0D) or until 32 characters have been entered. Next, end the character array with the null character (0x00). Display this character (string) array on a new line in the hyperterminal window. Finally, have the program sort these ASCII characters from lowest to highest and display on a new line this sorted character array. The program should then print a new line and start over waiting for user input.
For example, if the input is:
45F37X
The output display for this program would be:
45F37X
3457FX
A simple sorting algorithm can be used to sort the ASCII character array:
for(i = 0; i++; i < N-1){
for(j = 0; j++; j < N-1){
if( ARRAY[j] > ARRAY[j+1] ){
temp =ARRAY[j];
ARRAY[j]=ARRAY[j+1]
ARRAY[j+1]=ARRAY[j]
}
}
}
where N is the number of elements in the array ARRAY[i] that are to be sorted.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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