Write a program to find the number of times that a given word occurs in a sentence using pointers.  ​​​​​​​Read data from standard input. The first line is a single word, which is followed by general text on the second line. Read both up to a new line character, and insert a terminating null before processing. Typically output should be : The word is “ the ”. The sentence is  “ the cat on the mat “ . The word occurs 2 times.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter12: Points, Classes, Virtual Functions And Abstract Classes
Section: Chapter Questions
Problem 19SA
icon
Related questions
Question

Write a program to find the number of times that a given word occurs in a sentence using pointers. 

​​​​​​​Read data from standard input. The first line is a single word, which is followed by general text on the second line. Read both up to a new line character, and insert a terminating null before processing.

Typically output should be :

The word is “ the ”.

The sentence is  “ the cat on the mat “ .

The word occurs 2 times.

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Lists
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