well so far I have done this, it can read the file
Code:
#include <iostream.h>
#include <fstream.h>
#include <assert.h>
void main( int argc, char* argv[] )
{
assert( argc >= 2 ) ;
ifstream accfile( argv[1] ) ;
if ( !accfile )
{
cerr << "File " << argv[1] << " not found\n" ;
exit(1) ;
}
}
Contestants c ;
accfile >> c.name >> c.club >> c.age >> c.500 >> c.1000 >> c.1500 >> c.2000 ;
const int ACC_MAX = 20;
Contestants accs [ACC_MAX];
int filesRead = 0;
do
{
accfile >> accs[filesRead].name
>> accs[filesRead].club
>> accs[filesRead].age
>> accs[filesRead].500
>> accs[filesRead].1000
>> accs[filesRead].1500
>> accs[filesRead].2000 ;
if (accfile)
{
filesRead++ ;
}
} while (accfile) ;
cout << filesRead << "Accounts Read\n" ;
}
and i've have been working on a struct, it isn't complete yet but this is what i have so far
Code:
struct Contestants
{
char name;
char club;
int age;
double 500;
double 1000;
double 1500;
double 2000;
};
void raceWinner ( Contestants c )
{
for ( c.2000 < ACC_MAX;
}
i could be very well barking up the wrong tree, but i am trying everything at the moment.