0
I am gettind 'can not be used as function' error for yc.
This program is to plot naca airfoils and i used 'armadillo' library to use linspace function in c++. https://code.sololearn.com/c5oVnnX82f90/?ref=app https://code.sololearn.com/c5oVnnX82f90/?ref=app
2 Answers
+ 4
You're trying to use a primitive type as a function. yc is a float. Trying to use yc(i) in a constructor/method like fashion isn't valid when used after the declaration. The () use on a primitive type isn't an actual constructor, but more of an initializor. It need to be used at the time of declaration to be valid.
int yc(x); // ok
int yc = int(); // ok
int yc;
if (blah==blah) {
yc(x) = .......; // Not ok
}
So,
yc(i) = (m/(p*p))*((2*p*(x(i)))-(x(i)*x(i)));
Will not work. This looks almost like you're attempting to index yc like an array and set that indexes value.
Depending on what you're actually trying to do this may be what you want instead:
yc = (m/(p*p))*((2*p*(x(i)))-(x(i)*x(i)));
I'm not sure what your intent is with the use of (i) here though.
0
Thanks for replying. Here my intent to use i is to calculate yc's value for each different value of x.