Răspuns:
#include <fstream>
using namespace std;
ifstream fin("fisier.in");
int i=1, j;
double v[1000];
int main()
{
while (fin>>v[i])
i++;
fin.close();
ofstream fout("fisier.in");
for (j=1; j<i; j++)
fout<<v[i]<<" ";
fout<<(v[i]+v[i-1])/2;
return 0;
}