+ 3
String split
I need a c++ function that splits each word in a string into a vector. using getline(cin,str) So if the user inputs "Hello World!" the vector should contain either (Hello,World!) or (Hello, World) depending on how you want to do it, it doesn't matter to me. I got it to work with arrays, but not vectors.
11 odpowiedzi
+ 6
Daniel, why you expect two versions of outputs ("Hello", World!") and ("Hello", "World").
If you want to exclude anything other than alphanumeric then that is more than just splitting a string, as there is character filter implementation involved.
I just need a bit clarification of your actual intention 👍
+ 5
Daniel Cooper It's quite alright, but my doubt stands still, do you want the splitter to choose to ignore punctuation or other characters, as I see you expected two different outputs from the splitter, one with exclamation mark, and one without.
+ 5
Daniel Cooper Can you post the link to the code you're working on so I have a basic understanding where this is going? I think I might be able to help a bit.
You mentioned Discord, you mean in SoloLearn Discord server or that of another server you joined?
+ 4
Good job Daniel Cooper 👍
Is that Discord server good or what? I'm interested if it is good.
+ 2
I've also seen you post quite a few variations of basically the same question, but you rarely even comment a given answer.
So instead of making post after post, it would help if you stuck to one thread and, as Ipang said, communicate a bit more!
+ 2
It was really a choice for the answerer if they wanted to include special chars or not. Lol
I can probably figure it out myself, but I included the output without the special chars in case the person answering wanted to do it that way.
Sorry for the confusion guys. Was in a hurry to get it figured out before work so I could reply to the discord user who needed it. Next time I'll just ask one question or just put more effort into solving it myself. Lol
+ 2
Ok, apparently I can't figure out the filter. Any tips?
+ 2
https://code.sololearn.com/c7Nxs4x2HWnF/#cpp
I figured out the filter. I was looking at the problem backwards. Lol
All I need now is to make the word check ignore caps.
Edit: I found out how to ignore caps.
And it's not the Sololearn server. DIfferent server.
Edit Again: Here's the finished code:
https://code.sololearn.com/cQw8SYY0V944/#cpp
Thanks to anyone who helped
+ 2
Pretty good. It's a homework help server. Literally called Homework Help. You can find it on discord.me I think.