1 Assume that title and last are C-string variables, as shown below. Write a code fragment to eliminate the last word in title. Assume that title has two or more words and that the words are separated by spaces.
char title[101] = "Introduction to the C++ Programming Language";
2Assume that title and last are C-string variables, as shown below. Write a code fragment to copy the last word in title to last. Assume that title has two or more words and that the words are separated by spaces.
char title[101] = "Introduction to the C++ Programming Language";
char last[101];
3Assume that name and first are C-string variables, as shown below. Write a code fragment to check if the first names match. In this case, assign true to match.
char name[51] = "Smith, Jane";
char first[51] = "Jane";
bool match = false;
4Assume that title and last are C-string variables, as shown below. Write a code fragment to copy the contents of last at the end of title with a space in front of it. Assume that title has two or more words and that the words are separated by spaces. Assume that there is enough memory to add a new word to title.
char title[101] = "Indroduction to the C++ Programming";
char last[20] = "Language";
5Assume that title is C-string variables, as shown below. Write the definition of a function named countWords() that takes this string as an input parameter and returns the number of words in the string. Assume that the words are separated by a single space.
char title[101] = "Introduction to the C++ Programming";
int count = countWords(title);