Здравствуйте, у меня такая проблема:
| Код | vector < vector <int> > array(p+1, vector<int>(2, 0)); //создаю двумерный динамический массив
...
while(1) //заполняю его { inFile >> array[p][1]; inFile >> array[p][2]; p++; array.resize(p, vector<int>(2, 0)); if (inFile.peek() == EOF) break; }
... //пытаюсь вычислить расстояние Евклида
vector <double> distance (p); for(int i=0;i<p-1;i++) { distance[i] = sqrt(pow((array[i+1,1]-array[i,1]),2)+pow((array[i+1,2]-array[i,2]),2)); }
|
выдается такая ошибка:
| Цитата | [BCC32 Error] meandering.cpp(54): E2093 'operator-' not implemented in type 'vector<int,allocator<int> >' for arguments of the same type [BCC32 Error] meandering.cpp(54): E2015 Ambiguity between 'std::pow(float,int) at c:\program files\codegear\rad studio\5.0\include\math.h:265' and 'std::pow(double,int) at c:\program files\codegear\rad studio\5.0\include\math.h:273'
|
Не подскажете, что можно сделать? Пытался выполнять приведение типов, т.е.
| Код | int x1, x2, y1, y2; x1=int(array[i,1]);
|
но тоже ничего не вышло. Спасибо.
Модератор: настоятельно рекомендую делать вывод компилятора цитатой, а не кодом. |