Let's get this out at the start, you allude to output in your first post but your example does not show any attempts at output, you haven't even included the <iostream> header. If you post code, lets see the whole thing since this appears to be a relatively small program and we shouldn't have to guess at what important/relevant things you might be leaving out..
Code:
imarknum=8; // int ??
double fidy []={112.999,112.994,112.994,-0.005,-0.007,-13.004, -113.003,-113.005};
vector<double> yfid(fidy,fidy+imarknum);
I would prefer to use sizeof to get the number of elements in the array (get rid of imarknum):
Code:
double fidy []={112.999,112.994,112.994,-0.005,-0.007,-13.004, -113.003,-113.005};
vector<double> vfid(fidy,fidy+(sizeof(fidy)/sizeof(fidy[0])));
This way if you were to ever change the number of elements in the fidy array, you wouldn't need to change imarknum.
Also, just so you are aware/exposed to these things, there are template functions available that can help you do much of what you are trying to accomplish with the sum and deduct functions, i.e. the following:
Code:
double sum (const vector<double>& v)
{
double c=0.000000000;
for(int i=0; i < v.size();++i)
c +=v[ i ];
return c;
}
...
double k=sum (vect);
Can be replaced with a simple call to the accumulate function:
Code:
#include <numeric>
...
double k = std::accumulate(vect.begin(),vect.end(),0.0);
The deduct function can likewise be replaced with some code to copy the passed in vector into a new vector (using the vector's copy constructor) followed by a call to the transform function on the newly copied vector and using the minus function object along with the bind2nd function adapter. Although admittedly in this case, you aren't going to be saving much in the way of typing.