Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++ language Program Objective Write a program that asks the user to enter three letters of the alphabet in any order. It then prints

Using C++ language

image text in transcribed

image text in transcribed

Program Objective Write a program that asks the user to enter three letters of the alphabet in any order. It then prints out those three letters in alphabetical order. Program Specifications Your program must ask the user to enter three letters of the alphabet (lowercase or uppercase) in any order. The user must be able to enter the three letters one right after the next, or with whitespace between each, or with each letter on a newline (i.e. enter/return after each letter). The program must then print out those three letters in alphabetical order on a new line. For example, user entries of krd or k rd or k should all result in a program output of dkr Your program should use variables of type char. Note that char variables are stored in memory by their ASCII code (see slides 8-9 of Lecture 5). Since the numerical order of the ASCII codes is equivalent to the alphabetical order of the characters represented by these ASCIl codes, alphabetical order can be determined by simply comparing the letters entered as if they were numbers. For the purpose of this assignment, assume that uppercase letters come before lowercase letters. For example: aBc should result in Bac bBA should result in ABb Your program must interact with the user and produce output exactly as follows (note the spaces and spelling). The example below shows program output if the user enters pfR. Enter any three letters from the alphabet in any order. pfR Rfp Algorithm Hints What your program needs to do is sort the three characters entered. But because only three things are being sorted, don't implement some complicated sorting algorithm (don't even use the bubble sort algorithm you learned in Lab 1 that is best implemented with loops). Instead use nested if-else structures to figure out the alphabetical order of the three characters. There are a few different ways to do this but here is some partial pseudocode to get you started. if the first character is less than the second character and the third character print out the first character f the second character is less than the third character print out the second character and then the third character else print out the third character and then the second character Remember that the user may enter the same letter more than once. Your program MUST be able to handle this scenario. As always, you will be more efficient if you design the logic of your program with a flowchart or pseudocode before you start coding

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions

Question

Question Can a Keogh plan fund be reached by the owners creditors?

Answered: 1 week ago

Question

Question What happens to my plan if I die?

Answered: 1 week ago