Hello everyone i have an assignment to prodram a resistant temperature detector but i seem to keep getting stuck on step two and beyond.Any help would be appreciated.
This is the assignment:
Write a C++ program that:
1. Reads the data file, temperaturedata.txt, exactly as it appears, into a two-dimensional array. Note: Failure to use a two dimensional array will cost up to a 10 point deduction. To skip over the heading text you will need to use the function getline discussed in Section 2.12.3.
2. Uses three separate single result double functions (do not use void functions) to determine the slope, intercept, and r-squared for each data set. Failure to use three double single result functions will cost up to a 10 point deduction.
3. Writes the results of the analysis and the input data to the screen using good format (i.e. use iomanip functions) for your output.
4. Prints to the screen the ID (R1, etc) of the metal alloy that demonstrates the most linear relationship (i.e. r-squared closest to 1.0).
5. In a while loop the program asks the user for a resistance and the program returns the temperature using the RTD alloy that has the best fit (the one that you found in part 4). The program ends when a zero is entered for the resistance.
And this is what I have so far:
using namespace std;
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cmath>
double slope(double[11][5]);
double intercept(double[11][5]);
double rsquared(double[11][5]);
int main()
{
char lines[80];;
double array[11][5];
int i,j;
cout<<"Raw data of resistance in ohms versus temp in F ";
cout<<endl;
ifstream data("temperaturedata.txt");
data.getline(lines,80);
for (i=0;i<11;i++)
{
for (j=0;j<5;j++)
{
data>>array[i][j];
cout<<setw(10)<<array[i][j];
}
cout<<endl;
}
cout<<endl<<"Results: \tR1\tR2\tR3\tR4"<<endl;
system("pause");
return (0);
}