Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could you make this CODE work for VISUAL STUDIO? #include > #include #include using namespace std; tuple readData(){ ifstream infile; infile.open(linear.txt); if(!infile){ cerr < >x[i]&&i>y[i];

Could you make this CODE work for VISUAL STUDIO? #include > #include #include using namespace std; tuple readData(){ ifstream infile; infile.open("linear.txt"); if(!infile){ cerr<<"Unable to open file linear.txt"; exit(1); // call system to stop } int number_of_lines = 0; string line; while(getline(myfile, line)){ number_of_lines++; } infile.close(); double x[number_of_lines]; double y[number_of_lines]; infile.open("linear.txt"); for(int i=0; infile>>x[i]&&i>y[i]; } infile.close(); return make_tuple(x,y); } tuple slopeIntercept(double[] x, double[] y){ n = sizeof(x)/sizeof(*x); double sumX = 0; double sumY = 0; double sumX2 = 0; double sumXY = 0; for(int i=0;idata; double[] y = get<1>data; auto equation = slopeIntercept(x,y); cout<<"Equation of the line is: y = "<<(get<0>equation)<<"x + "<<(get<0>equation)equation)); cout<<"Goodness of Fit = "<>xvalue; cout<<"Corresponding y value is: "<

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions