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
|
#include <iostream>
using namespace std;
#include <math.h>
#include <fstream.h>
void loadData(int dayDate[], double highTemp[],double recordTemp[],
int recordTempYear[], double relativeHumidity, int&dataCount);
int main()
{
double highTemp[100],recordTemp[100],relativeHumidity[100];
int recordTempYear[100], dayDate[100],dataCount;
loadData(dayDate[],highTemp[],recordTemp[],recordTempYear[],
relativeHumidity[], dataCount);
return 0;
}
void loadData(int dayDate[], double highTemp[],double recordTemp[],
int recordTempYear[], double relativeHumidity[], int&dataCount)
{
fstream infile;
infile.open("c:\\Documents and Settings\\Jake\\Desktop\\arraytest.txt", ios::in);
dataCount=0;
do
{
infile>>dayDate[dataCount];
infile>>highTemp[dataCount];
infile>>recordTemp[dataCount];
infile>>recordTempYear[dataCount];
infile>>relativeHumidity[dataCount];
++dataCount;
}
while(dayDate[dataCount-1] != 0);
infile.close();
--dataCount;
}
|