A litle problem

Heloo
I have a problem
I need this

marius.txt
liniedetest1
unalttext
unpicdetest
douapicaturi

marius1.txt
ied
pic

output
marius2.txt
liniedetest1
unpicdetest
douapicaturi

Last edited on
program has only words of parting sentence

Ex

dad has apples

and if I want thie

dadhasapples

?
Do you understand what your program is doing? (I guess someone else did this for you?)

Since you never provide the description of your problem, I gues what it may be:
Instead of words you have a string where you want to find a substring?

If so you need to modify contains_word_in(...). Instead of if (words.find(cuv) != words.end()) you need if (propoz.find(cuv) != propoz.end()).

See:
http://www.cplusplus.com/reference/string/string/find/

And this time: Refrain from letting some one else providing the perfect solution. Try to figure it out on your own. Otherwise you will never understand what's going on.
I tried but it does not work

my program do this

Marius.txt
dad has apples

marius1.txt
apples

marius2.txt
dad has apples

empty space do not red

if I want this

Marius.txt
dadhasapples

marius1.txt
apples

marius2.txt
dadhasapples

don't worck
Again: Do you even understand a single part of the cod you provided?

Line 14 breaks the line into words and dismiss the spaces. Line 26 compares this words. This is obviously not what you want.

I would guess that your teacher gave you an assignment. So what is this assignment?

if I want this
Yes the lines above main() do not do what you want. So forget them and start again:

four loops:
The first reads the lines into vector1 using push_back(...).
The second reads the lines into vector2 as above.
The third iterates over vector1 (Ex.: for(size_t i = 0; i < vector1.size(); i++) vector1[i]....)
The fourth (inside of the third, aka nested) iterates over vector2 (See ex. above). Use the string [vector1[i].]find[(vector2[j])] function to determine if your desired condition is met -> output.

This is far from optiomal, but it should let you grasp how things work. That's the purpose of your assignment! (If that is your assignment)
my assignment is this

marius.txt
liniedetest1 I faund ied in line writh in output liniedetest1
unalttext
unpicdetest I faund pic in line writh in output unpicdetest douapicaturi I faund pic in line writh in output douapicaturi

marius1.txt
ied
pic

output
marius2.txt
liniedetest1
unpicdetest
douapicaturi

I know what do my code..
Last edited on
any idea
This is the idea:
four loops:
The first reads the lines into vector1 using push_back(...).
The second reads the lines into vector2 as above.
The third iterates over vector1 (Ex.: for(size_t i = 0; i < vector1.size(); i++) vector1[i]....)
The fourth (inside of the third, aka nested) iterates over vector2 (See ex. above). Use the string [vector1[i].]find[(vector2[j])] function to determine if your desired condition is met -> output.
Any problems with this?
My code is god i must
Yes, I see that you're just trolling.
Topic archived. No new replies allowed.