Challenge 13

Description

The purpose of this challenge is to manually manipulate character arrays. This challenge converts text into URL-safe text.

Requirements

      1. Write a program to make ensure that strings are URL-safe. For example, here is a URL, or website address://stackoverflow.com/questions/23553138/how-can-i-follow-oop-base-concepts-with-qobject-derived-class-instance
        The underlined text in the URL above is considered URL-safe
      2. Create a function void make_safe(char safetext[], char rawtext[]).
        This function will:

        • Return the converted URL-safe string via the 1st parameter
        • Convert everything in rawtext to lowercase
        • Convert everything that is not a number or a letter into a dash: ‘-‘
        • Will ensure that only one dash will represent a string of non-alphanumeric characters
      3. Declare a char array to hold a maximum of 255 characters.
      4. Ask the user to enter a string. Use cin.getline(rawtext, 255) function call to get the string from the user.
      5. Show the URL-safe string

Sample Interaction / Output

Enter a string: Is 42 the meaning of life?!?! Yes or     NO?
Safe version: is-42-the-meaning-of-life-yes-or-no- 

LEGEND
PROGRAM OUTPUT
USER INPUT
FROM INPUT

CATALOG ID: CPP-CHAL0013

Print Requirements