Question: Please do not use string class, instead use c-style function Write the code for 2 functions. The first function is: void printSubString( const char* str1

Please do not use string class, instead use c-style function

Write the code for 2 functions.

The first function is:

void printSubString( const char* str1 , int beginIndex, int endIndex )

This takes a string and 2 indexes to it ( the beginIndex and the endIndex ) and prints the sub string.

The second function :

void printWordsInAString( const char* str1 )

takes a string and prints the words out. You may use the function "printSubString" from this function .

#include #include #include

using namespace std;

//Prints the characters in the string str1 from beginIndex //and including endIndex void printSubString( const char* str1 , int beginIndex, int endIndex ) {

//To do Write your code here }

void printWordsInAString( const char* str1 ) {

//To do Write your code here

}

int main() { char str1[] = "The fox jumps over the fence." ; char str2[] = "The fox jumps over the fence." ; char str3[] = " The fox jumps over the fence." ; char str4[] = "The fox jumps over the fence. " ;

printWordsInAString( str1 ) ; cout << endl ; printWordsInAString( str2 ) ; cout << endl ;

printWordsInAString( str3 ) ; cout << endl ; printWordsInAString( str4 ) ; cout << endl ;

return( 1 ) ; }

Output:

The:fox:jumps:over:the:fence.: The:fox:jumps:over:the:fence.: The:fox:jumps:over:the:fence.: The:fox:jumps:over:the:fence.:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!