0

C++ problem

So we have a text of maximum 100 characters, each word is divided by a space. The problem says that we have to replace all the even length words with # and then write the text ... can someone help with an algorithm in C++?

9th May 2018, 9:19 AM
Oprea Radu
Oprea Radu - avatar
17 Antworten
+ 2
Comments and modified code included as comments in your code. Probably should have posted here 🙄
9th May 2018, 12:38 PM
Duncan
Duncan - avatar
+ 2
Can you create a new code in the code playground on SoloLearn and enter what you've tried on paper?
9th May 2018, 9:54 AM
Duncan
Duncan - avatar
+ 1
can you just bring an example
9th May 2018, 9:36 AM
Amidkhon
Amidkhon - avatar
+ 1
as I understand we should replace even length words into another string element isn't it??
9th May 2018, 9:39 AM
Amidkhon
Amidkhon - avatar
+ 1
do u need an algorithm?
9th May 2018, 9:42 AM
Amidkhon
Amidkhon - avatar
+ 1
I will post the code later, ok
9th May 2018, 9:44 AM
Amidkhon
Amidkhon - avatar
+ 1
it is difficult to explain by chat
9th May 2018, 9:45 AM
Amidkhon
Amidkhon - avatar
+ 1
Have you at least made an attempt. People are happy to help, but certainly not do your homework.
9th May 2018, 9:45 AM
Duncan
Duncan - avatar
+ 1
whenever you have time... Our school teacher ain't that great and we are struggling to understand some thing... and by we I mean the whole class. Thanks a lot!
9th May 2018, 9:46 AM
Oprea Radu
Oprea Radu - avatar
+ 1
I actually have an attempt... but it's on paper and I realised that it's wrong before I posted... in my example the algorithm writes each word and then no word if there's no word ... too bad I can't take a photo. Plus it ain't my homework it's just me exercising for the finals.
9th May 2018, 9:49 AM
Oprea Radu
Oprea Radu - avatar
+ 1
https://code.sololearn.com/ctDBwATEI0py/?ref=app From what I remember this is the piece of code. I don't have my notebook with me but as I said is not right.
9th May 2018, 10:23 AM
Oprea Radu
Oprea Radu - avatar
+ 1
Thanks a lot !
9th May 2018, 12:39 PM
Oprea Radu
Oprea Radu - avatar
0
twist... if there are no even words the programm will write "No words found" INSTEAD of the text
9th May 2018, 9:31 AM
Oprea Radu
Oprea Radu - avatar
0
I don't have one right now
9th May 2018, 9:37 AM
Oprea Radu
Oprea Radu - avatar
0
yes... we should replace even length words with #, odd words stays the same.
9th May 2018, 9:40 AM
Oprea Radu
Oprea Radu - avatar
0
yes
9th May 2018, 9:42 AM
Oprea Radu
Oprea Radu - avatar
0
in a few minutes
9th May 2018, 9:55 AM
Oprea Radu
Oprea Radu - avatar