Hello everyone, I am new to the forums. I am having some issue with this function I have written. There are a few errors I am having trouble understanding. The frustrating part about this is that this code works when it is not a function and part of a different program. Any way here is the list of errors that it is throwing (I am using g++ to compile on linux)
error2.cpp: In function ‘void sinembed(double*, double*, double, int, int)’:
error2.cpp:60: error: expected primary-expression before ‘=’ token
error2.cpp:60: error: expected `)' before ‘;’ token
error2.cpp:60: error: invalid type argument of ‘unary *’
error2.cpp:60: error: expected `;' before ‘)’ token
error2.cpp:61: error: expected primary-expression before ‘=’ token
error2.cpp:61: error: expected `)' before ‘;’ token
error2.cpp:61: error: invalid type argument of ‘unary *’
error2.cpp:61: error: expected `;' before ‘)’ token
And here is the problematic code:
1 2 3 4 5 6 7 8 9 10 11
|
void sinembed(double x[MAX], double y[MAX], double amplitude, int templength, int delay)
{
int count = 0;
for(int n=0; n<MAX; n++){
if (count<templength){
x[n] += amplitude*sin((2*pi*n)/51);
y[n+delay] += amplitude*sin((2*pi*n)/51);
}
count++;
}
}
|
Lines 60 and 61 are the same as 6 and 7.
This post was originally in the beginners forums and someone suggested that it could be a problem with using :
using namespace std;