Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 main.cpp In main.cpp do the following step by step: 1. Include iostream, cstring, and cctype libraries. 2. Globally define character array titlel[] of length

image text in transcribed

image text in transcribed

1 main.cpp In main.cpp do the following step by step: 1. Include iostream, cstring, and cctype libraries. 2. Globally define character array titlel[] of length 30, and initialize it with "Data Structures In C++" (2 points). 3. Globally define character array title2[] of length 30, and initialize it with Data Structures In C++", where there are three spaces between Data and Structures. Moreover, there are two tabs and one space between Structures and In (2 points). 4. Globally define two dimensional array of characters password[] [] with four rows and 30 columns. Initialize it with "monkey", "MonnkeeY", "M8nnkeeY", and "M8nnkeeY!". For initializa- tion use braces (3 points). 5. Define the following functions. (a) Define function void splittedPrint (...) that receives an array of characters. It prints the words which are separated by white-spaces (tabs and spaces) in separate lines (4 points). Hint: Use proper functions from cctype library to identify white-spaces. Check the sample output below for examples. (b) Define function void stringFlipCase (...) that receives an array of characters. It prints the input array of characters where the uppercase alphabetic characters are flipped to lowercase, and lowercase alphabetic characters are flipped to uppercase (4 points). Hint: Use proper functions from cctype library to identify lowercase/uppercase characters and to flip them. Check the sample output below for examples. (c) Define function void stringTrimNonAlphanumeric(...) that receives an array of characters. It prints the input array of characters where all non-alphanumeric characters are removed (3 points). Hint: Use proper functions from cctype library to identify alphanumeric characters. Check the sample output below for example. (d) Define function bool isValidPassword (...) that receives an array of characters that represents a potential valid password). This function returns true if the input is a valid pass- word. Otherwise, it returns false. Here are the rules that define a valid password: (i) Passwords must at least be of length 8 (2 points). Hint: Use proper function from cstring library to study string length. (ii) Passwords must at least have one lowercase alphabetic character (2 points). (iii) Passwords must at least have one uppercase alphabetic character (2 points). (iv) Passwords must at least have one digit (2 points). Hint: Use proper function from cctype library to study whether a character is digit. (v) Passwords must at least have one special character (2 points). Special characters are !"#$%&'()*+,-./:;?@[\]^_'{}- Hint: Use proper function from cctype library to study whether a character is a special one. Your function must report all of the reasons for rejecting the input. It must also report if an input is acceptable (3 points). Check the sample output below for examples. In main() function do the following step by step, using the functions defined above: (I) Print out the splitted titlel using the function defined above (1 points). (II) Print out the splitted title2 using the function defined above (1 points). (III) Print out titlel, where the cases are flipped (using the function defined above) (1 points). (IV) Print out titlel, where non-alphanumeric characters are removed (using the function defined above) (1 points). (V) Print out title2, where non-alphanumeric characters are removed (using the function defined above) (1 points). (VI) Within a for loop check the validity of the passwords given in the array password[] [] (using the function defined above) (2 points). The output of the program may look like the following: Splitting titlel: Data Structures In C ++ Splitting title2: Data Structures In C++ Flipping the case in titlel: DATA STRUCTURES iN c++ Trimming non-alphanumeric characters in titlel: DataStructures Inc Trimming non-alphanumeric characters in title2: Data Structures Inc monkey Not Accepted: Passwords must be at least 8 characters long. monkey Not Accepted: Passwords must at least include one uppercase alphabetic character monkey Not Accepted: Passwords must at least include one digit. monkey Not Accepted: Passwords must at least include one special character: !"#$%&'()*+,-./:;?@[\]^_'{l)- MonnkeeY Not Accepted: Passwords must at least include one digit. MonnkeeY Not Accepted: Passwords must at least include one special character: !"#$%&'()*+,-./:;?@[\]^_'{l)- M8nnkeeY Not Accepted: Passwords must at least include one special character: !"#$%&'()*+,-./:;?@[\]^_'{I} M8nnkeeY! Accepted

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions