Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 lettersbetween.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 letters and the the path moving backwards through the alphabet to be cbazyxwvutsrqponmlk, which takes letters. Hence the program will print cdefhijk as letters is less than Note In the case where the number of letters are equal, the program will print the letters moving forwards through the alphabet. examples lettersbetween Please enter starting letter: H Please enter target letter: K HIJK lettersbetween Please enter starting letter: b Please enter target letter: w bazyxw lettersbetween Please enter starting letter: Q Please enter target letter: D QRSTUVWXYZABCD lettersbetween Please enter starting letter: m Please enter target letter: m m
Design a program named lettersbetween.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 letters and the the path moving backwards through the alphabet to be cbazyxwvutsrqponmlk, which takes letters. Hence the program will print cdefhijk as letters is less than Note In the case where the number of letters are equal, the program will print the letters moving forwards through the alphabet.
examples
lettersbetween
Please enter starting letter: H
Please enter target letter: K
HIJK
lettersbetween
Please enter starting letter: b
Please enter target letter: w
bazyxw
lettersbetween
Please enter starting letter: Q
Please enter target letter: D
QRSTUVWXYZABCD
lettersbetween
Please enter starting letter: m
Please enter target letter: m
m
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