Question: Important Notes: 1 . Formatting: Make sure that you follow the precise recommendations for the output content and formatting: for example, do not change the
Important Notes:
Formatting: Make sure that you follow the precise recommendations for the output content and
formatting: for example, do not change the text in the first problem from Please enter a string
of maximum characters: to Enter string:
Comments: Header comments are required on all files, for each function, and recommended throughout
the rest of the program. Points will be deducted if no headerfunction are included.
Write a program that asks the user to enter two strings with a maximum length of and then performs one of two
possible operations provided as command line arguments to the program. The possible command line options and
the associated operations are as follows:
Option i Operation: if given this option, the program should create a new string that is built by
interspersing the two strings, by alternatively placing one character at a time from each string. When one of
the strings exhausted, the program should copy the remaining of the characters from the second string. This
functionality should be implemented in a function called intersperse, which takes as parameters the
two strings and returns a pointer to the newly created string. Your function should use dynamic memory
allocation to generate the new string.
For example, if string is abcde and string is the resulting string should be
abcde
Option w Operation: if given this option, the program should create a new string that is built by
concatenating the two given strings, in which there has been a character inserted in betweeImportant Notes: Formatting: Make sure that you follow the precise recommendations for the output content and formatting: for example, do not change the text in the first problem from Please enter a string of maximum characters: to Enter string: Comments: Header comments are required on all files, for each function, and recommended throughout the rest of the program. Points will be deducted if no headerfunction are included. Write a program that asks the user to enter two strings with a maximum length of and then performs one of two possible operations provided as command line arguments to the program. The possible command line options and the associated operations are as follows: Option i Operation: if given this option, the program should create a new string that is built by interspersing the two strings, by alternatively placing one character at a time from each string. When one of the strings exhausted, the program should copy the remaining of the characters from the second string. This functionality should be implemented in a function called intersperse, which takes as parameters the two strings and returns a pointer to the newly created string. Your function should use dynamic memory allocation to generate the new string. For example, if string is abcde and string is the resulting string should be abcde Option w Operation: if given this option, the program should create a new string that is built by concatenating the two given strings, in which there has been a character inserted in between every character in those strings. There should be a character between the two strings, but no such character at the end of string This functionality should be implemented in a function called widenstars, which takes as parameters the two strings and returns a pointer to the newly created string. Your function has to use dynamic memory allocation to generate the new string. For example, if string is abcde and string is the resulting string should be abcde Project :Command Line Arguments, Dynamic Memory allocation, and Strings Project Goals The goal of this project is to: Get students familiar with command line arguments Get students familiar with dynamic memory allocation Get students familiar with double pointers Your program should function as follows items underlined are to be entered by the user: combinestrings i Please enter a string of maximum characters: abcde Please enter a string of maximum characters: The combined string is: abcde Or combinestrings w Please enter a string of maximum characters: abcde Please enter a string of maximum characters: The combined string is: abcde Notes: You may not include the string library, but you may use the strlen and strcmp functions from the last project Before terminating, your program needs to deallocate the space allocated for the newly created strings Save your program as combinestrings.cpp
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
