unable to compile the code

Hi everyone,
I was trying to solve a problem on topcoder. I typed the code and compiled but it is not compiling at all.Here is the code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

class Surname{
  private:
    vector <string> surname;
  public:
    int bestSurname(vector <string> surname){
      vector <int> val;
      int value=0,temp,cnt;
      for(int i=0;i<surname.size();i++){
        for(int j=0;j<surname[i].size();j++)
          value+=surname[i].at(j);
        val.push_back(value);
      }
      temp=val[0];
      cnt=0;
      for(int i=1;i<val.size();i++)
        if(temp>val[i])
          cnt=i;
      return cnt;
    }
};

The compiler is showing "vector does not name a type"
Please tell me what syntatical error i have done in my code.
I could not find any error myself
1
2
3
std::vector <string> surname;
//...
std::vector <int> val;
@MiiNiPaa Thank you very much.Now my code compiles correctlly
Topic archived. No new replies allowed.