Write the function deleteFirst that takes a sentence, a string and the starting index of the given string in the senten as parameters. The function will delete the given string in the sentence. Example Run#1: Enter a sentence: home sweet home alabama home Enter a string: home The new form of the sentence after deletion: sweet home alabama home c) (20 points) Modify the previous solution, so the program will delete the first occurrence of the searched WORD. Write the function deleteFirst that takes a sentence, a word and the starting index of the given word in the senten as parameters. The function will delete the given WORD in the sentence.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

use C programming and use comments.

1. a) (20 points) Write the function findFirst which takes a sentence and a string to be searched as input parameters,
finds and returns the index of the first occurrence of the given string in the sentence. If the sentence does NOT contain
the searched string the function should return -1.
Write a C program that will input a sentence, find and display the position of the given string in the sentence. If the
searched string is NOT found, display an appropriate message.
Example Run#1:
Enter a sentence: this is a good idea
Enter a string: is
The first occurence of the string <is> is 2
Example Run#2:
Enter a sentence: Why your smartphone will be your next pc
Enter a string: are
The sentence does NOT contain the string <are>
b) (20 points) Modify the previous solution, so the program will delete the first occurrence of the searched string.
Write the function deleteFirst that takes a sentence, a string and the starting index of the given string in the sentence
as parameters. The function will delete the given string in the sentence.
Example Run#1:
Enter a sentence: home sweet home alabama home
Enter a string: home
The new form of the sentence after deletion: sweet home alabama home
c) (20 points) Modify the previous solution, so the program will delete the first occurrence of the searched WORD.
Write the function deleteFirst that takes a sentence, a word and the starting index of the given word in the sentence
as parameters. The function will delete the given WORD in the sentence.
Example Run#1:
Enter a sentence: brush your teeth before you go to bed.
Enter a
word: you
The new form of the sentence after deletion: brush your teeth before go to bed.
Transcribed Image Text:1. a) (20 points) Write the function findFirst which takes a sentence and a string to be searched as input parameters, finds and returns the index of the first occurrence of the given string in the sentence. If the sentence does NOT contain the searched string the function should return -1. Write a C program that will input a sentence, find and display the position of the given string in the sentence. If the searched string is NOT found, display an appropriate message. Example Run#1: Enter a sentence: this is a good idea Enter a string: is The first occurence of the string <is> is 2 Example Run#2: Enter a sentence: Why your smartphone will be your next pc Enter a string: are The sentence does NOT contain the string <are> b) (20 points) Modify the previous solution, so the program will delete the first occurrence of the searched string. Write the function deleteFirst that takes a sentence, a string and the starting index of the given string in the sentence as parameters. The function will delete the given string in the sentence. Example Run#1: Enter a sentence: home sweet home alabama home Enter a string: home The new form of the sentence after deletion: sweet home alabama home c) (20 points) Modify the previous solution, so the program will delete the first occurrence of the searched WORD. Write the function deleteFirst that takes a sentence, a word and the starting index of the given word in the sentence as parameters. The function will delete the given WORD in the sentence. Example Run#1: Enter a sentence: brush your teeth before you go to bed. Enter a word: you The new form of the sentence after deletion: brush your teeth before go to bed.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Introduction to Coding
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education