I apologize for the non explanation. What my program is supposed to do is first read input from a file like such:
Springston Ray L 374926490 40392.37
Heineman Doug A 264592791 19473.08
Alagappan Solayappan Q 567493784 20493.76
Easton Dwight R 193465943 30284.33
Chatila Sami K 029375938 1943.88
Johnson Devin E 736549283 197493.93
Fazal Talha S 643847651 2947.08
Punjal Jagan D 463248598 29473.71
Pruitt Terry O 846239402 19374.50
Ma Glen T 264957640 134.29
Lewis Troy R 002947594 19374.12
Khan Eddy U 947604592 9476.66
Tran Michael B 204946731 652.09
Hopkins Weston S 463947204 2940.45
Store it in a linked list and then read data from another file similiar to this one:
Khan Eddy U 947604592 -80.50
Chatila Sami K 029375938 +2041.72
Ma Glen T 264957640 -409.85
Heineman Doug A 264592791 -503.96
Jiang Nan A 648937212 +29478.94
Tran Michael B 204946731 -705.08
Davis Brian W 294765949 -80.00
Hsieh Jill I 749394000 +8403.91
Sharma Rashmi O 994739403 +294.08
Chatila Sami K 029375938 -1029.84
Chatila Sami K 029375938 -4083.19
Nguyen Lam A 847308840 +4029.38
Alagappan Solayappan Q 567493784 -20493.75
Easton Dwight R 193465943 -10294.88
Alagappan Solayappan Q 567493784 -10.00
IT should read one record off teh second file one at a time and look to see if it already exists on the list if so it should do a series of checks like to see if its a withdrawal or a deposit and such and such. For the most part i have every thing working fine except the part where if the person exist on the list and the amount they are trying to withdraw is larger than their current balance i delete them. The only problem i have is when i read the last name Alagappan Solayappan, he is at the top of the list (the head) i need to delete the head and i can't figure out how to do it.
The code below is the part where im trying to delete the head.
Code:
if((temprecord->balance < tempptr->balance))
{
fprintf(infile3,"%s %s %s, %s, is attempting a withdrawal of $%.2lf, but does not have sufficient funds,you will be deleted from list.\n\n",temprecord->fname,temprecord->initial,
temprecord->lname,temprecord->socialnum,fabs(temprecord->balance));
if(tempptr == *bankrecords) {
}
else {
prev->next=tempptr->next;
free (tempptr);
printlist(bankrecords);
}
return 0;
}