Challenge 25

Description

The purpose of this challenge is to manually manipulate character arrays. This challenge “translates human to dog.”

Requirements

  1. Write a program to translate any entered string into a variation of the word “Woof”
  2. Ask the user to enter a string — use a character array to receive this input. Set your array to hold a string to hold up to 100 characters.
  3. Create a function bool void translate(char human[], char dog[]). The function will take in text via the human parameter and pass the translated text via the dog parameter. Think of the human parameter as the input and the dog parameter as the output
    1. Translate any one-character word as “w”
    2. Two-character word as “wf”
    3. Three-character words become “wof”
    4. Four-character words become “woof”
    5. 6-character words become “woooof”
    6. and so on, longer words will have a ‘w’ as the first character and an ‘f’ as the last character and however many o’s to have an equivalent resulting length
    7. Maintain the case as entered by the user. If the user enters “Hello” this becomes “Wooof”
    8. Maintain any other characters entered by the user. If the user enters “Hello, Charlie!” this becomes “Wooof, Wooooof!”
  4. Ask the user to enter a string. Use cin.getline(char_variable, 100) function call to get the string from the user in main.
  5. Display the translated message

Sample Interaction / Output

Enter a string: Hello
Wooof

Enter a string: How are you today?
Wof wof wof wooof?

LEGEND
PROGRAM OUTPUT
USER INPUT
FROM INPUT

CATALOG ID: CPP-CHAL0025

Print Requirements