Question
language is C++ program 1 Write a function removeSpace that takes one string argument (by value), removes spaces from this string using stringstream, and returns
language is C++
program 1
Write a function removeSpace that takes one string argument (by value), removes spaces from this string using stringstream, and returns the resulting string. Write a main program to test your function. Your main program should:
- prompt the user to enter a string string1
- call the function removeSpace and send string1 as argument
- print the new string value.
Sample run:
Please enter a phrase: Welcome to CS211, let the fun begin
The resulting phrase is: WelcometoCS211,letthefunbegin
Program 2
Rewrite the function removeSpace from program 1 that removes spaces from this string using stringstream. The function is now a void function that takes one string argument by reference. Write a main program to test your function. Your main program should:
- prompt the user to enter a string string1
- call the function removeSpace and send string1 as argument
- print the new string value (in main not in the function).
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