Thread: Search() algorythm

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    932

    Search() algorythm

    I'm trying to use the algorithm Search() with strings.
    I get an error at the line where i marked.
    Could somebody please give me a hint what am i doing wrong? Thanks in advance!

    Code:
    int main () {
      vector<string> myvector ;
      vector<int>::iterator it;
      
      string str = "search";
      string match = "ea";
      myvector.push_back(str);
      
      it = search (myvector.begin(), myvector.end(), match.begin(), match.end());   // error
    
      if (it != myvector.end())
        cout << "Match found at position: " << int(it - myvector.begin()) << endl;
      else
        cout << "Match not found." << endl;
      
      system("pause");
      return 0;
    }
    Sorry for the typo: algorithm.
    Last edited by Ducky; 01-18-2008 at 02:08 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Logical errors with seach function
    By Taka in forum C Programming
    Replies: 4
    Last Post: 09-18-2006, 05:20 AM
  2. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  3. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM