This is the code I have written for average.h
#ifndef _average_h
#define _average_h
#include<vector>
double avg(std::vector<double> a);
#endif
This is the code I have written for average.cpp
#include "average.h"
using namespace std;
double avg(std::vector<double> a)
{
    double sum=0;
    for(int i=0;i<a.size();i++)
    {
        sum=sum+a[i];   
    }
    return sum;
}
This is the code I have written for main.cpp
#include "average.h"
#include<iostream>
#include<vector>
using namespace std;
int main()
{
    vector<double> b;
    double x;
    while(cin)
    {
        b.push_back(x);
    }
    double res=avg(b);
    cout<<res;
    return 0;
}
I can't understand what's the problem. Please help.
 
    