```cpp
#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class zuixiaoerchengfa
{
public:
zuixiaoerchengfa(vector<double> x, vector<double> y) {
double t1=0, t2=0, t3=0, t4=0;
for (int i = 0; i < x.size(); i++)
{
t1 += x[i]*x[i];
t2 += x[i];
t3 += y[i];
t4 += x[i] * y[i];
}
double a = (t4*x.size() - t2*t3) / (t1*x.size() - t2*t2);
double b = t3 / x.size() - a*t2 / x.size();
cout << a <<" "<< b<<endl;
};
private:
};
int main()
{
vector<double> x = { 1,2,3,4 };
vector<double> y = { 6,5,7,10 };
zuixiaoerchengfa zl(x,y);
return 0;
}