ПОМОГИТЕ ,ПОЖАЛУЙСТА ,СРОЧНО УЖЕ ДАЖЕ НЕ ЗНАЮ ЧТО ДЕЛАТЬ !!!=(

Модераторы: Hawk, Romeo, Absurd, DeeJayC, WinMain

Ответить
Антонио91
Сообщения: 2
Зарегистрирован: 10 янв 2013, 20:16

компелятор ругается ,выдает две ошибки (ошибки написаны).помогите исправить.



#include "actionVector.h"
#invlude <vector>
#include <iostream>
#include <math.h>

using namespace std;

void actionVector(vector<int> &numX,vector<int> &numY,int &x,float &sum,int n,float*y,float*y)
{
float sum=0;
float&t=sum;
float*y=&t;

int x=0;
int&r=x;
int*m=&r;
for(int i=0; i <= n-2; i++)
{
x++;
sum+=sqrt((numX[i+1]-numX)*(numX[i+1]-numX)+(numY[i+1]-numY)*(numY[i+1]-numY));
};

cout << "\nLine = " << sum << " " << x;

}






#include <vector>
#include <iostream>
#include "create.h"
#include "actionVector.h"
#include <math.h>

using namespace std; //если будет препод недоволен убери тут коммент и везде убери std в коде

int main()
{
int n;
//получаем у пользователя колличество натуральных чисел
cout << "Please, input number and press Enter\n";
cin >> n;
int x;
float sum;


vector<int> numX(n); // Создаем вектор, состоящий из n элементов типа float, значение которых равно 0
vector<int> numY(n);

createVector(numX,numY,n);

for(int i=0; i <= n; ++i)//вывод коордиант
{
cout << i << "( " << numX << "," << numY << " )";
};

//считаем сумму
actionVector(numX,numY,sum,x,n);
///L:\ProgrammingSidorov\main.cpp||In function 'int main()':|
L:\ProgrammingSidorov\main.cpp|30|error: invalid initialization of reference of type 'int&' from expression of type 'float'|
L:\ProgrammingSidorov\actionVector.h|6|error: in passing argument 3 of 'void actionVector(std::vector<int, std::allocator<int> >&, std::vector<int, std::allocator<int> >&, int&, float&, int&)'|
||=== Build finished: 2 errors, 0 warnings ===|

}







#include "create.h"
#include <vector>
#include <iostream>

using namespace std;

void createVector(vector<int> &numX,vector<int> &numY,int &n)
{

cout << "Please, input " << n << " numbers for operation: " << '\n'; //вводим цифры в вектор
for(int i=0; i <= n-1; i++)
{

cout << "x" << i << " = ";
cin >> numX;
cout << "y" << i << " = ";
cin >> numY;

};
}




#ifndef CREATE_H_INCLUDED
#define CREATE_H_INCLUDED
#include <vector>
using namespace std;

void createVector(vector<int> &numX,vector<int> &numY,int &n);

#endif // CREATE_H_INCLUDED




#ifndef ACTIONVECTOR_H_INCLUDED
#define ACTIONVECTOR_H_INCLUDED
#include <vector>
using namespace std;

void actionVector(vector<int>&numX,vector<int>&numY,int&x,float&sum,int&n);
/// L:\ProgrammingSidorov\actionVector.h|6|error: in passing argument 3 of 'void actionVector(std::vector<int, std::allocator<int> >&, std::vector<int, std::allocator<int> >&, int&, float&, int&)'|

#endif // ACTIONVECTOR_H_INCLUDED

L:\ProgrammingSidorov\actionVector.h|6|error: in passing argument 3 of 'void actionVector(std::vector<int, std::allocator<int> >&, std::vector<int, std::allocator<int> >&, int&, float&, int&)'|
Ответить