use C programming and use comments. is 2Example Run#2:Enter a sentence: Why your smartphone will be your next pcEnter a string: areThe sentence does NOT contain the string b) (20 points) Modify...


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

Extracted 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 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 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.
Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here