Error: expression must have integral or unscoped enum type

My program does not work because I always have this error message but I have no idea how to correct it. I have already looked it up but no answer could really help me :(

I am reading coordinates of clients and facilities in a file and I want to create a matrix that contains all the distances

Here are my codes

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
vector <double> x_faci;
vector <double> y_faci;
vector <double> x_client;
vector <double> y_client;

int f, c; //f = nbr of facility, c = nbr of clients

ifstream in(instance);
if(in.fail())
{ cout<<"ERROR: Opening input file";}

else
{
    in>>c>>f;

    x_faci.resize(f);
	y_faci.resize(f);
	x_client.resize(c);
	y_client.resize(c);

	//Read Facility coordinates
	for (int l =0; l < f;l++)
	{
		in>>x_faci[l];
		in>>y_faci[l];
	}

	//Read Clients coordinates
	for (int l= 0; l < c; l++)
	{
	        in>>x_client[l];
		in>>y_client[l];
	}
     
        vector <vector <double> distances;
        distances.resize(f);
        for (int i = 0; i < f; i++)
        {
            distances[i].resize(c);
        }
      
        for(int i =0; i < f; i++)
        {   for(int j =0, j < c; j++)
            {
         distances[i][j] = srqt((x_faci[i]-x_client[j])^2)+(y_faci[i]- y_client[j])^2);
             }
        }
   
}



the error is at the line: distances[i][j] = srqt((x_faci[i]-x_client[j])^2)+(y_faci[i]- y_client[j])^2);

I have tried many things but nothing work.
Thank you in advance!
...-x_client[j]) ^2

What do you think this is doing? Why do you think that way?
Last edited on
I wanted to use that to square the brackets ...

That was the problem! Thank you ! Stupid mistake :s

If just wrote srqt((x_faci[i]-x_client[j])*(x_faci[i]-x_client[j]))+(y_faci[i]- y_client[j])*(y_faci[i]- y_client[j]))

and it works
Last edited on
Topic archived. No new replies allowed.