Starting from:
$30

$24

Homework #6 Solution

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
    • a count of how many times the last letter has recently been seen in a row
    • the letter of the longest sequence seen so far
    • a count of 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 it’s time to stop.
You should turn in (in a pocket folder): This assignment/grading sheet, a statement of completeness, a structure chart of your program, and a full printout of your program.  All items should be labeled appropriately.  You should also place a “soft” (electronic) copy of your main.cpp file in an appropriately named folder in your private FTP folder.

More products