Question
Write a function Split(...) that is given a string, a separator character, an array to fill and the max number of elements in the array
Write a function Split(...) that is given a string, a separator character, an array to fill and the max number of elements in the array as parameters and returns an integer result. The function will separate each substring of the given string between separator characters and place it in the array. The function returns the number of substrings extracted.
For example: Split("cow/chicken/fish", '/', words[], size ) would return the count of 3 and fill the array with "cow", "chicken", "fish"
use c++
int Split (string str , char e, string words[ ], int size ) { words[0]=str; int h=0; int f =0; int c=1; if(str.length()==0) { c=c-1; } else { for(int i=0;i return c; }
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