vector parameter

This is a discussion on vector parameter within the C++ Programming forums, part of the General Programming Boards category; Trying to read a vector into a class but keep getting an error stating cannot pass parameter 1 into isanagram ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    4

    Question vector parameter

    Trying to read a vector into a class but keep getting an error stating cannot pass parameter 1 into isanagram class.. What am I going wrong.. code below.

    #include <vector>
    using namespace std;
    class word
    {
    public:
    string isanagram(const vector& orig, int count)
    {
    // some code
    }
    };

    void main()
    {
    vector<string>file(10,1);
    word a;
    a.isanagram(file,10);
    }
    Last edited by tony1; 09-17-2001 at 11:00 AM.

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    have you a :-

    using namespace std; ?
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    The function needs to know what type of vector to expect.

  4. #4
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    Also a vector of strings won't take an integer as the second argument in it's constructor.

  5. #5
    Registered User kitten's Avatar
    Join Date
    Aug 2001
    Posts
    109
    The function needs to know what type of vector to expect
    In other words

    string isanagram(const vector<string>& orig, int count)
    Making error is human, but for messing things thoroughly it takes a computer

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21