I need help with function GetStorm. It invovles data structures and I don't understand data structures that well. The program is supposed to build a list of hurricanes of category 3 or above, display the total number of storms processed & the number of category 3 or above hurricanes stored in the list (first ten hurricanes), then display the top ten storms that are sorted by category from highest to lowest. My other problem is how do you add 6 to NewStorm->duration? And how do you update NewStorm->wind and NewStorm->pressure? Just to let you know that when you look at my program at the bottom of this message you will see that I didn't fill in functions PrintStorm and DisplayStorm yet. I don't need help with PrintStorm and DisplayStorm functions yet, I only need help with GetStorm. I don't know what type of compiler I have, but I type CC filename.cc to compile my program. Anyways, here's my code:

// necessary library header files:
#include<iostream.h>
#include<fstream.h>
#include<iomanip.h>
#include<string.h>

// global user-defined types:
struct Storm {
int beginDate;
int duration;
char name[15];
int category;
int wind;
int pressure;
};

// function prototypes:
int GetRecord( ifstream &input, int &y,int &m, int &d, int &h,
int &s, char name[], int &wind, int &pres);
Storm* GetStorm( ifstream& input );
int SaffirSimpson( int w );
void Sort( Storm* List[], int NStorms );
void DisplayStorms( char* title, Storm* List[], int NStorms );
void PrintStorm( Storm* StormPointer );

// Constants
const int MAX_STORMS = 200;
const float KnotsToMPH = 1.15;

int main( void ) {
Storm* List[MAX_STORMS];
Storm* CurrentStorm; // storm returned by GetStorm
int NStorms = 0; // number in aray List
int Total = 0; // total number of storms in the input file

// replace with interactive version
ifstream input("test2.data");

// while we have storms to process
while( (CurrentStorm = GetStorm( input ) ) != NULL ) {
++Total;
if( CurrentStorm->category < 3 )
delete CurrentStorm;
else
List[NStorms++] = CurrentStorm;
}

input.close();

cout << "Number of storms: " << Total << endl;
cout << "Hurricanes with category 3 and above: " << NStorms << endl;
DisplayStorms("First Ten Storms", List, 10 );

Sort( List, NStorms);
DisplayStorms("Top Ten Storms", List, 10 );

}

int GetRecord( ifstream &in, int &year, int &month, int &day, int &hour,
int &seq, char name[], int &wind, int &pres ) {
// reads one "record" from the input, and stores in reference arguments
// returns 0 if end-of-file, 1 if record read

float junk;

if (!(in.eof())) {
input >> year >> month >> day >> hour >> seq >> name[]
>> junk >> junk >> wind >> pres;
return 1;
}

return 0;
}

Storm* GetStorm( ifstream& in ) {
// Build a Storm structure, and return the poointer
// static is necesary to save the last record read for
// the next storm.

static int year = 0, month, day, hour, seq, wind, pressure;
static char name[15];
static status = 1;
int current, cat;
Storm* NewStorm; // we'll return this pointer to the new storm object
double mph;
// If the last storm caused end-of-file, we're done.(return NULL)
if( status == 0 )
return NULL;

// If this is the first time this function is called,
// then read first record.
if( year == 0 )
GetRecord(in, year, month, day, hour, seq, name, wind, pressure);

// Make a storm object and initialize it with info from the current record
NewStorm = new Storm;
NewStorm->beginDate = (year * 1000) + (month * 100) + day;
NewStorm->duration = hour;
//strcpy
NewStorm->wind = wind;
NewStorm->pressure = pressure;

current = seq;

// Now, keep reading records as long as they go with this storm.
// Watch out for end-of-file!
status = GetRecord(in, year, month, day, hour, seq, name, wind, pressure);
while((current == seq) && (status == 1)) {
//update storm info:
if(NewStorm->wind < wind)
NewStorm->wind = wind;
if(pressure <= 0)
NewStorm->pressure = pressure;

NewStorm->duration += 6;
NewStorm->category = SaffirSimpson(wind);

//get next record
GetRecord(in, year, month, day, hour, seq, name, wind, pressure);
}

// convert from knots to mph
mph = wind/1.15;

// and return the pointer to the new storm object:
return *NewStorm;
}

void PrintStorm( Storm* ptr ) {
// display one storm



return;
}

void DisplayStorms( char* title, Storm* List[], int NStorms ) {
// display NStorms storms
// print some title and column headings; make a loop
// and invoke function "PrintStorm" for each storm.

cout << "Number of storms: "<< NStorms << endl;
cout << "Hurricanes with category 3 and above: "<<
cout << "First ten storms "<< endl;
cout << "Begin Date" << setw(10) << "Duration (hours)" << "Name" << setw(10)
<< "Category" << "Maximum Winds (mph)"
<< "Minimum Pressure (mb)" << endl;
}

int SaffirSimpson( int wind ) {
// Compute storm category, using the Saffir-Simpson scale

int category;

if(wind > 134)
category = 5;
else if ((wind < 134) && (wind > 113))
category = 4;
else if ((wind < 113) && (wind > 96))
category = 3;
else if ((wind < 96) && (wind > 83))
category = 2;
else if ((wind < 83) && (wind > 64))
category = 1;
else if ((wind < 64) && (wind > 34))
category = 'TS';
else
category = 'TD';

return category;
}

void Sort( Storm* x[], int N ) {
// bubble sort the list of Storm pointers
int pass = 0, k, switches;
Storm* temp;

switches = 1;

while( switches ) {
switches = 0;
pass++;
for( k = 0; k < N - pass; k++ ) {
if(x[k] > x[k + 1]) {
temp = x[k];
x[k] = x[k + 1];
x[k + 1] = temp;
switches = 1;
}
}
}

return;
}