Access over 35 million academic & study documents

Cant output Sorted w X Course ECON 101 MAX CS16 PA 09 x V Ma

Content type
User Generated
Rating
Showing Page:
1/4
Can\'t output \"Sorted\" w X Course: ECON 101 -MAX
CS16: PA 09 x V Mail-Darren Pan-Out x V y token]- e
Given The Following He x Darren -> c Dcs.ucsb.edu/-
cspensky//labs/pa09.html :: Apps D New Tab y -
__Evolife.cn- [PS4/PS3/XB1/XB36 D sufficed: KC Article :
PS4 Safe Chapter 8: Programming Project 14 This should
be solved in the split.cpp file Given the following header
vector split (string target, string delimiter); implement the
function split so that it returns a vector of the strings in
target that are separated by the string delimiter For
example: split(\"10,20,30\", \",\") should return a vector
with the strings \"10\", \"20\", and \"30\". Similarly,
split(\"do re mi fa so la ti do\", \" \") should return a vector
with the strings \"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 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 string: The substrings are: \"10\", \"20\", \"30\"
Enter string to split: do re mi fa so la ti do Enter delimiter
string: The substrings are: \"do\", \"re\", \"mi\", \"fa\", \"so\",
\"la\", \"ti\", \"do\" Note: the fourth line in the second
example has a single space character (it is not an empty
line) The strings printed by the program should include a
newline at the end Chapter 8: Programming Project 15

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/4
Solution
SplitTest.cpp
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
using namespace std;
vector<string> split(string targer, string delimiter);
int main()
{
string s, delimiter;
vector<string> tokens;
cout << \"Enter string to spilt\" << endl;
getline (cin,s);
cout << \"Enter delimiter string\" << endl;
getline (cin,delimiter);
tokens = split(s, delimiter);
cout << \"The substrings are \";
for(int i = 0; i < tokens.size(); i++)
{

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/4

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 4 pages?
Access Now
Unformatted Attachment Preview
Can\'t output \"Sorted\" w X Course: ECON 101 -MAX CS16: PA 09 x V Mail-Darren Pan-Out x V y token]- e Given The Following He x Darren -> c Dcs.ucsb.edu/cspensky//labs/pa09.html :: Apps D New Tab y __Evolife.cn- [PS4/PS3/XB1/XB36 D sufficed: KC Article : PS4 Safe Chapter 8: Programming Project 14 This should be solved in the split.cpp file Given the following header vector split (string target, string delimiter); implement the function split so that it returns a vector of the strings in target that are separated by the string delimiter For example: split(\"10,20,30\", \",\") should return a vector with the strings \"10\", \"20\", and \"30\". Similarly, split(\"do re mi fa so la ti do\", \" \") should return a vector with the strings \"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 comma s 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 wh ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
I was struggling with this subject, and this helped me a ton!

Studypool
4.7
Indeed
4.5
Sitejabber
4.4

Similar Documents