Answered step by step
Verified Expert Solution
Link Copied!

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Solve the integral:

Answered: 1 week ago

Question

What is meant by Non-programmed decision?

Answered: 1 week ago

Question

What are the different techniques used in decision making?

Answered: 1 week ago

Question

=+What is the most that you should pay to complete development?

Answered: 1 week ago

Question

=+development and make the product, should you go ahead and do so?

Answered: 1 week ago