Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This code is in C++. Please read and follow all the instructions carefully. Thank you! Given the following function header: vector split (string target, string

image text in transcribed

This code is in C++.

Please read and follow all the instructions carefully. Thank you!

Given the following function header: vector split (string target, string delimiter): implement the function split so that that it returns a vector of the strings in target that are separated by the string delimiter. For example: split("10, 20, 30", ", ") should returns a vector with the string "10", "20", and "30". Similarly, split("do re mi fa so la ti do", "") should return a vector with the string "do", "re", "mi", "fa", "so", "la", "ti", and "do". Write a program that inputs two strings and calls your function to split the first target string by the second delimiter string and prints the resulting vector all on line line with elements separated by commas. REQUIRED: You MUST use vectors to write this program. You may not use any C++ functions that we have NOT discussed in lecture. The strings printed by the program should include a newline at the end. The program should print a string of text to the terminal before getting each line of input from the user. A session should look like one of the following examples (including whitespace and formatting), with possibly different numbers in the output: Enter string to split 10, 20, 30 Enter delimiter strings, The substrings are: "10", "20", "30" or Enter string to splits do re mmi fa so la ti do Enter delimiter string: The substrings are: "do", "re", "mi", "fa", "so", "la", "ti", and "do

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions