Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
This is the question:
The program will prompt for and accept two strings from the user:
-
one which is the target string we are looking for and
-
the other string is the source string in which we are searching for the target string
Example Dialog:
Enter target string: the
Enter source string: Now is the time for all good men to come to the aid of their party.
The string 'the' occurs 3 times in the string 'Now is the time for all good men to come to the aid of their party.'
The target and source strings are case-sensitive. That is, 'the' will NOT match 'The' in the source string.
You may not use the count method, split method, or lists in your solution.
so far all i have is
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images
Knowledge Booster
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
- Part 2: Forms often allow a user to enter an integer. Write a program that takes in a string representing an integer as input, and outputs yes if every character is a digit 0-9. Ex: If the input is 1995, the output is: yes Ex: If the input is 42,000 or 1995!, the output is: no Hint: Use a loop and the isdigit() function (don't forget to include the cctype library). Do not use break! please do it in c++arrow_forwardThe in operator may be used to check whether a string is included inside another string. Is it true or false?arrow_forward8. Sentence Capitalizer Write a program with a function that accepts a string as an argument and returns a copy of the string with the first character of each sentence capitalized. For instance, if the argu- ment is “hello. my name is Joe. what is your name?" the function should return the string "Hello. My name is Joe. What is your name?" The program should let the user enter a string and then pass it to the function. The modified string should be displayed.arrow_forward
- Evaluating a Sentence Seirtence Noun phase Varb Detor- mirar Vorb Noun phrasa Detor- Adjecive mings Noun The dog chased the black cat. FIGURE 192. Parsing: structure ol a sentence Using the concepts you have learned about Strings, create a well- documented program that will give the user information about a sentence as follows: - The program will ask the user to enter a sentence. Do not use any punctuation for the first version. - The program will return the following information: o Number of words in the sentence. o Number of vowels in the sentence. (a, e, i, o, u) o Number of consonants in the sentence. The program should keep looping and asking the user for more sentences to be processed until the user indicates that they are finished by entering in a value to quit.arrow_forward1 – Write a python program that prompts the user to enter a string and checks if the string contains vowels or not. If the string contains any vowels, it should print “This string contains vowels” otherwise it should print “This string does not contain any vowels”.arrow_forward1. strcmp( str1, str2 ); returns the value 0 if str1 and str2 are equal. a. true b. false 2. The strlen function returns the _________. a. number of characters in a string, including the null terminator b. number of characters in a string, not including the null terminatorarrow_forward
- Solve only 2nd partarrow_forward(1) Prompt the user for a string that contains two strings separated by a comma. Examples of strings that can be accepted: Jill, Allen Jill , Allen Jill,Allen Ex: Enter input string: Jill, Allen (2) Report an error if the input string does not contain a comma. Continue to prompt until a valid string is entered. Note: If the input contains a comma, then assume that the input also contains two strings. Ex: Enter input string: Jill Allen Error: No comma in string. Enter input string: Jill, Allen (3) Extract the two words from the input string and remove any spaces. Store the strings in two separate variables and output the strings. Ex: Enter input string: Jill, Allen First word: Jill Second word: Allen (4) Using a loop, extend the program to handle multiple lines of input. Continue until the user enters q to quit. Ex: Enter input string: Jill, Allen First word: Jill Second word: Allen Enter input string: Golden , Monkey First word: Golden Second word: Monkey Enter input string:…arrow_forwardWrite a function that accepts a string as an argument and returns true if the argument ends with the substring .doc'. Otherwise, the function should return falsearrow_forward
- Given string stringValue on one line, string addStr on a second line, and string partialString on a third line, insert the contents of addStr in stringValue right before the first occurrence of partialString. Ex: If the input is: FuzzyBear Wuzzy Be then the output is: FuzzyWuzzyBear #include <iostream>#include <string>using namespace std; int main() { string stringValue; string addStr; string partialString; getline(cin, stringValue); getline(cin, addStr); getline(cin, partialString); /* Your code goes here */ cout << stringValue << endl; return 0;}arrow_forwardLAB: Warm up: Text analyzer & modifier (1) Prompt the user to enter a string of their choosing. Output the string. (1 pt) Ex: Enter a sentence or phrase: The only thing we have to fear is fear itself. You entered: The only thing we have to fear is fear itself. (2) Complete the GetNumOfCharacters() function, which returns the number of characters in the user's string. We encourage you to use a for loop in this function. (2 pts) (3) In main(), call the GetNumOfCharacters() function and then output the returned result. (1 pt) (4) Implement the OutputWithoutWhitespace() function. OutputWithoutWhitespace() outputs the string's characters except for whitespace (spaces, tabs). Note: A tab is '\t'. Call the OutputWithoutWhitespace() function in main(). (2 pts) Ex: Enter a sentence or phrase: The only thing we have to fear is fear itself. You entered: The only thing we have to fear is fear itself. Number of characters: 46 String with no whitespace: Theonlythingwehavetofearisfearitself.arrow_forwardogramming Languages home-335 LAB Mad Lib-loops Mad Libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (and hopefully funny) ways Write a program that takes a string and an integer as input and outputs a sentence using the input values as shown in the example below The program repeats until the input string is quit and disregards the integer input that follows Ex If the input is apples 5 shoes 2 quit o the output is Eating 5 apples a day keeps you happy and healthy. Eating 2 shoes a day keeps you happy and healthy. LAB ACTIVITY B 9 3351 LAB Mad Lib-loops 2 #includearrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education