A litle problem

Jul 15, 2015 at 7:06am
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 Jul 15, 2015 at 2:21pm
Jul 15, 2015 at 7:15am
program has only words of parting sentence

Ex

dad has apples

and if I want thie

dadhasapples

Jul 15, 2015 at 7:33am
?
Jul 15, 2015 at 7:55am
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.
Jul 15, 2015 at 8:04am
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
Jul 15, 2015 at 8:40am
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)
Jul 15, 2015 at 9:58am
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 Jul 15, 2015 at 9:59am
Jul 15, 2015 at 10:54am
any idea
Jul 15, 2015 at 11:03am
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?
Jul 15, 2015 at 12:40pm
My code is god i must
Jul 15, 2015 at 1:03pm
Yes, I see that you're just trolling.
Topic archived. No new replies allowed.