Using the f , r , and i functions from preceding exercises, write a function called r that takes three character string arguments as follows
r
and that replaces s inside source with the character string s .The function should call
the f function to locate s inside source, then call the
r function to remove s from source, and finally call the
i function to insert s into source at the proper location.
So, the function call
r
replaces the first occurrence of the character string̎ inside the character string t , if it exists, with the string ̎ . Similarly, the function call
r
has the effect of removing the first asterisk inside the t array because the replacement string is the null string.
Want to see the full answer?
Check out a sample textbook solutionChapter 9 Solutions
Programming in C
Additional Engineering Textbook Solutions
C Programming Language
Modern Database Management
Database Concepts (7th Edition)
Experiencing MIS
Differential Equations: Computing and Modeling (5th Edition), Edwards, Penney & Calvis
Starting Out with Programming Logic and Design (4th Edition)
- To translate a sentence into pig Latin, create a function. When a word is written in pig Latin, its first character is dropped, shifted to the word's tail, and the letters "ay" are added. For instance, "hello world" would be "ellohay orldway" in pig Latin. Your function can be written to presume that each word has at least two letters, that there is one space between each word, and that there are no punctuation marks.arrow_forward) Write a function that updates the year of a student, i.e. if year is “Year1”, then update to “Year2”, if year is “Year2”, then update to “Year3”, if the year is “Year3” then updated to “Graduated”.arrow_forwardTo write a C++ function to accept the name of 5 students as strings and check how many student name’s starting with ‘R’ letterarrow_forward
- The function f multiplies it’s input by 8 and then subtracts 7 to produce its output. What is the symbolic representation of this operation?arrow_forwardTo translate a sentence into pig Latin, create a function. When a word is written in pig Latin, its first character is dropped, shifted to the word's tail, and the letters "ay" are added. For instance, "hello world" would be "ellohay orldway" in pig Latin. Your function can be written to assume that each word has at least two characters, is separated by a space, and is free of punctuation.arrow_forwardPlease provide step by step solution with a proper explanation. C++ Question: Write a function named "countGrades" that will accept a count as the total number of grades to be read in by the function. After reading the list of grades, it will return the following statistical data for that list of grades: - how many grades are passing ('A' or 'B' or 'C') - how many 'A' grades - how many invalid grades (not 'A', 'B', 'C', 'D' or 'F') For example, if the user passes in 1 and enters 'A', it will return 1, 1, 0 If the user passes in 3 and enters 'A', 'B', 'C', it will return 3, 1, 0 If the user enters in 5 and enters 'A', 'B', 'C', 'X', 'A', it will return 4, 2, 1arrow_forward
- Given a string str that consists of only 'a' and 'b'. Write a C++ function that takes the string str as parameter and returns true if the frequncy of both 'a' and 'b' is same, else the function returns false. Test the function for str = "aababb" and str = "abbabb"arrow_forwardHow to create a function str_asterisk() that takes a string of five words, and returns a list of five strings with the character in the index of the string replaced by an asterisk? For instance, the first character in the first string is replaced by an asterisk, the second character in the second string is replaced by an asterisk, etc.arrow_forward: Given a string, write a function to check if it is a permutation ofa palindrome. A palindrome is a word or phrase that is the same forwards and backwards. Apermutation is a rearrangement of letters. The palindrome does not need to be limited to justdictionary words.EXAMPLEInput: Tact CoaOutput: True (permutations: "taco cat'; "atco eta·; etc.)arrow_forward
- Write a function that accepts an item as an input and decides which, if any, interval it falls in given a list of non-overlapping intervals for the item. The question point 9122 lies in the third interval and 8122 lies in no interval, for instance, if the items are numbers and the intervals are 1643-2033, 5532-7643, 8999-10332, and 5666653-5669321.arrow_forwardQuestion 1: Complete the below function which takes an integer k and a string s as its arguments and returns a string formed by the every k'th character of s. For example, given k = 3 and s = "Burkay Genc is my teacher", your function should return "rye ae", because: Burkay Genc is my teacher ^ ^ ^ ^ ^ ^ ^ ^ 1231231231231231231231231 If there are not k characters in s, then the function should return empty string.arrow_forwardWrite a function that adds two digit-strings in base b, where 2 <= b <= 10. Each string may be as long as one million digits, and strings must be of equal length. Return the sum in a string that uses the same number base. Preferred: C++arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage