Question: Design a program named letters _ between.c that accepts a starting letter and target letter as input. The program should calculate the shortest path between

Design a program named letters_between.c that accepts a starting letter and target letter as input. The program should calculate the shortest path between the two given letters by either moving forwards or backwards through the alphabet. The program then prints out all the letters from the starting letter to the target letter along the shortest path. For example, if 'c' and 'k' were entered as the starting and target letters respectivley, the program would calculate the path moving forwards through the alphabet to be cdefhijk, which takes 8 letters and the the path moving backwards through the alphabet to be cbazyxwvutsrqponmlk, which takes 19 letters. Hence the program will print cdefhijk as 8 letters is less than 19. Note In the case where the number of letters are equal, the program will print the letters moving forwards through the alphabet.
examples
./letters_between
Please enter starting letter: H
Please enter target letter: K
HIJK
./letters_between
Please enter starting letter: b
Please enter target letter: w
bazyxw
./letters_between
Please enter starting letter: Q
Please enter target letter: D
QRSTUVWXYZABCD
./letters_between
Please enter starting letter: m
Please enter target letter: m
m

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!