I am having trouble printing the result, but before that it is not done because it is a new type created by struct
it does not calculate since it asks for type double
follow the code
#include <iostream>
using namespace std;
struct Ponto{
float x;
float y;
float d;
};
void LerRetangulo(Ponto ret[], int tam)
{
for(int i = 0; i<tam;i++)
{
cout <<"digite coordenadas x e y "<<i+1 <<endl;
cin >> ret[i].x>>ret[i].y;
}
}
void CalcDistancia(Ponto ret[], int tam ){
float h
for(int i = 0; i<tam;i++)
{
h = sqrt(pow ( ret[i].x,2) + pow ( ret[i].y,2)); // problema aqui !!!!
}
}
/*
aqui eu estava fazendo alguns teste
void imprimir(?,int tam){
for (int i=0;i<tam;i++){
cout<< "A distancia = "<<? <<endl;
}
*/
}
int main(int argc, char *argv[]) {
Ponto retangulo[4];
LerRetangulo(retangulo,4);
CalcDistancia(retangulo,4);
//imprimir(?,4); duvida aqui !!!!!
return 0;
}