I'm a newbie to programming, especially to C++. I've got a task, and its part is to write a function using a struct. 

```
struct S {
    float m; //how many
    int h; //where
    float mx;
};

int main() {
    S s;
    s.m=0.5;
    s.h=1;

    vector<float> v(10);
    for (int i=0;i<10;i++)
        v[i]=sin(i);
    S mx = max_search(v);

```

The function is ok, if (`mx.m>0.98935 && mx.m<0.9894 && mx.h==8`).

I came out with this code of function, but I know, it's quite defective. 

```
float max_search(vector<float> v) {
    int max=0;
    for (int i=0; i<v.size(); i++) {
       if (v[i]>max) {
        max=v[i];
       }
    return max;
    }
}

```

I don't know, what should I do with the type of function, and maybe the return value in also wrong.