Hello, this is my first post. I need help with this assignment here, dont know where to begin! maybe I should use strstr()? The output needs to be what is shown at the bottom. I cant use the string class, only c-style functions. Any hints would be welcome thank you!
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
//Prints the characters in the string str1 from beginIndex
//and including endIndex
void printSubString( const char* str1 , int beginIndex, int endIndex )
{
//code needed
}
void printWordsInAString( const char* str1 )
{
//code needed
}
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.: