well here is my problem....this might be a bit hard to explain.....we have a structure containing the 3 fields firstname, lastname, and phonenumber.....the program we are making is like an address book....when the user inserts a new entry, it's supposed to insert in the first blank space....so if you have 4 records...but you went back and deleted record 3.....when it prints it would print Record 1, Record 2, Record 4...but then if you were to insert another record, it would fill in Record 3 instead of Record 5....make sense? When a record is deleted, all that happens is the lastname field of that record is set to "00", so it won't print when an "00" lastname comes up....heres what we have tried:
Code:
case 'I':
case 'i':
int x, y;
for (x=0; x<rnumber; x++) // rnumber is the number of records //
{
y=strcmp(roster[x].lastname,"00");
if (y==1)
{
insert(&roster[x]);
x=rnumber; // so the loop will stop //
}
}
if (x<=rnumber)
{
insert(&roster[rnumber++]);
}
break;
this just isn't working....the "insert(&roster[rnumber++]);" works fine all by itself to insert to the next record....the code above is suppose to check every record to see if any of the lastnames are equal to "00", and if they are , it's supposed to insert the record there, quit the for loop, and NOT run the other insert.......any ideas?