Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Write a program that inputs a sequence of letters and keeps track of the longest consecutive sequence of the same letter within those inputted.

C++

Write a program that inputs a sequence of letters and keeps track of the longest consecutive sequence of the same letter within those inputted. The program should stop when the character . is inputted. Upper and lower case letters (for example, a and A ) should be considered equal.

Hints:

Checking to see if a character of input is a letter will involve two parts: Checking to see if a character is a lower-case letter can be done with the following (userInput is a character):

if ( userInput >= a && userInput <= z )...

Checking for upper-case (capital) letters is similar.

Some things that your program will need to keep track of (after inputting each letter, each of these may need to be updated):

- the last letter seen

- the number of the last letter which have recently been seen in a row

- the letter of the longest sequence seen so far

- how many letters were in the longest sequence seen so far

The executable program Gold06.exe demonstrates what your program should do. Note that it does not need to pause at the end since the user has already indicated its time to stop.

https://www.dropbox.com/sh/5ljmmkdf2419cgb/AAA75jn7-emWNhxBIs7Qh3gna/CMPR%20120%20Files?dl=0&preview=Gold06.exe

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

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions

Question

What is the hallmark clinical feature of a molar pregnancy?

Answered: 1 week ago