C Programming: Linear Search with Struct -
how do linear search struct?
we given
typedef struct { int month; int day; int year; } date; typedef struct { int hour; int minute; } time; typedef struct { char name[size]; char bloodtype[bloodtypesize]; } patient;
we given input file names , blood type:
joe_smith a- 12/13/2010 10:45 anabell_brown o+ 10/10/2012 13:10 regina_white a- 1/13/2008 19:29
1 a-
basically have linear search through names , blood types , see matches a- based on added first list
i trying figure out how linear search based on names space , blood type, space, , time. hints help! simple question has been years since had code in c. thanks!
do have more requirements? said "we given" set of typedef declarations , input. fro you've said, have load data arrays of appropriate type, search arrays.
given above typedefs, date[50] declare array of 50 date structures, filled input (date.month = month; date.year = year; date.day = day;) , on remaining data. linear search like
int = 0; while ( < numberofrecords ) { if ( patient[i].bloodtype == "a-" ) { // found match } }
Comments
Post a Comment