1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
double datafile ()
{
//FILLING DATA ARRAYS
// ask user for dat file
ifstream dat;
do {
cout << "Input filename where the raw data exist-->";
char filename [50];
cin.getline(filename,50);
dat.open(filename);
if (!dat.is_open())
cout << "File Does Not Exist!" << endl ;
} while (!dat.is_open());
// read from file and fill arrays
double data[10][3]; // array reads angle, w(angle) errw(angle)
int x = 0;
double a,b,c,d,e,f;
while ( dat >> a >> b >> c){
data[x][0] = a;
data[x][1] = b;
data[x][2] = c;
// cout << data[x][2] << endl;
x++;
}
return (data[10][3]);
}
//======================================================================
//======================================================================
double valuesfile ()
{
// SECOND ARRAY FILLING
// fill arrays for testing models
double a,b,c,d,e,f,g,h;
int x ;
ifstream table;
do {
cout << "Input filename where the data table exist-->";
char file [50];
cin.getline(file,50);
table.open(file);
if (!table.is_open())
cout << "File Does Not Exist!" << endl ;
} while (!table.is_open());
double values [10][6]; //array from 1967 table values are:
// jf , ji,l1,l2,f2,f4
x = 0 ;
while (table >> a >> b >> c >> d >> e >> f){
values [x][0] = a;
values [x][1] = b;
values [x][2] = c;
values [x][3] = d;
values [x][4] = e;
values [x][5] = f;
x++;
}
table.close();
return (values[10][6]);
}
//======================================================================
// MAIN PROG
//======================================================================
int main ()
{
double data[10][3] ;
data[10][3]= datafile;
double values[10][6] ;
values[10][6]= valuesfile;
// more stuff that doesn't matter
|