Tesponsiomty returned string.) Don't modify the original string. strings.cpp 1 #include using namespace std; 3 char* no_blanks (const char* str) { 4 int len = strlen(str); char * result =.. .; 7 int j = 0; for (int i = 0; i < len; i++) 10 if (str[i] !=' ') { 11 12 13 14 15 } 16 17 18 return result; 19

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question
100%

C++, fill in the blanks

Complete this function that produces a string from the given string with all blank spaces removed. Use new to allocate the result. (It is the caller's responsibility to delete the
returned string.) Don't modify the original string.
strings.cpp
#include <cstring>
using namespace std;
3
char* no blanks (const char* str)
{
4.
5
6
int len = strlen(str);
char * result = . . .;
int j = 0;
for (int i = 0; i < len; i++)
{
if (str[i] !='')
{
8
10
11
12
13
14
15
}
16
17
18
return result;
}
19
Transcribed Image Text:Complete this function that produces a string from the given string with all blank spaces removed. Use new to allocate the result. (It is the caller's responsibility to delete the returned string.) Don't modify the original string. strings.cpp #include <cstring> using namespace std; 3 char* no blanks (const char* str) { 4. 5 6 int len = strlen(str); char * result = . . .; int j = 0; for (int i = 0; i < len; i++) { if (str[i] !='') { 8 10 11 12 13 14 15 } 16 17 18 return result; } 19
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT