Description
The purpose of this challenge is to manually manipulate character arrays. This challenge converts text into URL-safe text.
Requirements
-
-
- 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 - 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
- Declare a char array to hold a maximum of 255 characters.
- Ask the user to enter a string. Use cin.getline(rawtext, 255) function call to get the string from the user.
- Show the URL-safe string
- 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
-
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