I coded this:
setInput(double* d) {
cout << " *d0 " << d[0] << " " << "*d1 " << d[1] << endl;
for (int i=0; i < _num_input; ++i)
_input[i] = d[i];
}
main () {
double input[2] = {4.50, 3.10};
double sum=0;
sum = input[0] + input[1];
for (uint i=0; i < 2; i++)
setInput (input);
cout << "input[0,1] " << input[0] << " " << input[1] << " " << sum << endl;
}
setInput(double* d) {
cout << " *d0 " << d[0] << " " << "*d1 " << d[1] << endl;
for (int i=0; i < _num_input; ++i)
_input[i] = d[i];
}
main () {
double input[2] = {4.50, 3.10};
double sum=0;
sum = input[0] + input[1];
for (uint i=0; i < 2; i++)
setInput (input);
cout << "input[0,1] " << input[0] << " " << input[1] << " " << sum << endl;
}
To copy to clipboard, switch view to plain text mode
Output is:
*d0 4.5 *d1 3.1000000000000001 //why this '1' at the end???
input[0,1] 4.5 3.1000000000000001 7.5999999999999996
*d0 4.5 *d1 3.1000000000000001 //why this '1' at the end???
input[0,1] 4.5 3.1000000000000001 7.5999999999999996
To copy to clipboard, switch view to plain text mode
what's that '1' ???? why does it appear only after setInput() call??
thanks
Bookmarks