Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started