error while sorting with stl

Hello!
I have a code that is not complete, but a have an error when i call sort(v.begin(), v.end(), compare); (line 48)
the error says: too many arguments to funciton;
can somebody give me a clue about this?

this 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
  #include <fstream>
#include <vector>
#include <iomanip>
#include <cmath>
#include <algorithm>
#define dmax 120000

using namespace std;

ifstream fin("infasuratoare.in");
ofstream fout("infasuratoare.out");

struct point {
    double x,y;
    };

vector <point> v(120000);
vector <point> hull(dmax);
int n;
double s;

//functions declaration

void read();
//reads the input file

double area(point x1, point x2);
// calculates the area of the triangle formed by the two points x1 & x2 with the origin O(0,0)

void first();
// replaces the first element form the vectorwith the first element from the left;

bool compare();
// compares the two polar angles

double polar(point p1);
// returnes the polar angle of the point p1



int main() {

    read();

    first();

// sort them by the polar angle
    sort(v.begin(), v.end(), compare);

//browsing the vector and verifying the points

    point a,b,c;
    a=v[0];
    b=v[1];

    
    return 0;
    }


void read() {

    fin>>n;

    for(int i=0; i<n; i++)
        fin>>v[i].x>>v[i].y;

    }


double area(point p1, point p2, point p3) {

    return (p1.x*p2.y+p1.y*p3.x+p2.x*p3.y-p2.x*p1.y-p1.x*p3.y-p3.x*p2.y)/2;

    }

bool compare(point p1, point p2) {

  return (polar(p1)<polar(p2));

    }

void first() {

    point d;
    int poz;

    for(int i=0; i<n; i++){
        if(v[i].x<d.x) {

            d=v[i];
            poz=i;
            }
        else if(v[i].y>d.y) {

            d=v[i];
            poz=i;
            }

    }

v[poz]=v[0];
v[0]=d;

}

double polar(point p1) {

return p1.y/(sqrt(p1.y*p1.y+p1.x*p1.x));

    }
closed account (G30GNwbp)
Look at line 33 and 77
oh... thanks:)
Topic archived. No new replies allowed.