Question
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
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:http://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
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-
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started