invalid types 'double[int]' for subscript array

Asked

Viewed 29 times

0

I have to do a Florentzproton function that takes two vectors and multiplies them using another Productovetorial function (which is in another class), then multiplies the resulting vector by a scalar number (q). Apparently he doesn’t let me multiply this q by the values of the vector F. I put . h and . cc of reference by way of doubt.

Mathematics. h

#include <iostream>
#include <math.h>
using namespace std;

class Mathematics
{
  float ProdutoVetorial(double B[3], double C[3]);
};

Mathematics.cc

#include <stdlib.h>
#include "Mathematics.h"

float Mathematics::ProdutoVetorial(double B[3], double C[3])
{
    double A[3];
    
    A[0]= (B[1]*C[2] - C[1]*B[2]);
    A[1]= (B[2]*C[0] - C[2]*B[0]);
    A[2]= (B[0]*C[1] - C[0]*B[1]);
    
    return A[3];
}

Physics. h

#include <math.h>

class Physics
{
  float FLorentzProton(double v[3], double B[3]);
};

Physics.cc

#include "Physics.h"

float Physics::FLorentzProton(double v[3], double B[3])
{   
    double q = 1.602*(10^-19);
    double F = float Mathematics->ProdutoVetorial(double v[3], double B[3]);
 
    for(int i=0; i<=2 ;i++) 
    {
        F[i] = q*F[i];
    };
    
    return F[3];
}
  • It also accuses "expected Primary-Expression before 'float'" in the F statement and does not know how to resolve

  • is line "double F = float Mathematics->Productovetorial(double v[3], double B[3]);"

  • 'float', makes the compiler wait for a statement, something that is also not valid as an assignment, as it is... just remove 'float'

  • the part of "doble v[3], double B[3]", also does not make the slightest sense, instead, just put the name of variables, "v,b", I believe it is the case

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.