I am a beginner in this and im having problem with a program, i want to make a function that will search for a spicific word in a sentence. Got stuck on the vector thing, Read some about it on the internet but nothing that helped me, Would be cool if someone would like to look at it for me.
I assumed it was needed to store all the words in the sentence. I want to type in for example: The wallet was empty. Then type in: wallet. Then i want the program to check if the word wallet does appear in the sentence and type something like: "Yes the word wallet was found".
Ok i have looked at it now and understand the most of it. The parts of it that i dont understand is:
1. What is the std::istream_iterator rows doing?
2. I get this error trying to compile the code:
26 C:\Dev-Cpp\main.cpp no matching function for call to `find(__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, std::string&)'
does this maybe have something to do with some settings in my compiler?
Btw, I am glad you are helping me :)
Ahh you are probably using the very very outdated version of Dev C++ Bloodshed. That IDE and Compiler hasn't been updated for several years so that is probably why you are getting that error. You have a few options.
1 Preferable) If you like Dev C++ for a IDE go over here http://orwelldevcpp.blogspot.com/2013/03/dev-c-541-released.html and download the up to date version of the new Orwell Dev C++.
2) If you don't mind which compiler/IDE you use download either codeblocks or Visual Studios Express.
3 Least Preferable) If for some reason you want to keep the old Dev C++ IDE you can just download any up to date compiler and install it. This is not recommended since the old Dev C++ Bloodshed IDE has many bugs that will never be fixed.
Ok. I installed code::blocks and checked the code but it is complaining at the same thing. But i checked the code in www.ideone.com and it says that the code is ok. So im not sure what the problem is.