Can anyone help me make a pseudocode for this function....cause its really difficult:'(
int updateRecord( FILE *fPtr )
{
int account; /* account number */
double transaction; /* transaction amount */
/* create clientData with no information */
struct clientData c = { 0, "", "", 0.0 };
/* obtain number of account to update */
printf( "Enter Loan No. to update ( 1 - 100 ): " );
scanf( "%d", &account );
/* move file pointer to correct record in file */
fseek( fPtr, ( account - 1 ) * sizeof( struct clientData ), SEEK_SET );
/* read record from file */
fread( &c, sizeof( struct clientData ), 1, fPtr );
/* display error if account does not exist */
if ( c.acctNum == 0 ) {
printf( "Loan #%d has no information.\n", account );
} /* end if */
else { /* update record */
printf( "\t\t%-6d %-16s %-11s %10.2f\n\n",
c.acctNum, c.lastName,
c.firstName, c.balance );
/* request transaction amount from user */
printf( "Enter charge ( + ) or payment ( - ): " );
scanf( "%lf", &transaction );
c.balance += transaction; /* update record balance */
printf( "\t\t%-6d %-16s %-11s %10.2f\n",
c.acctNum, c.lastName,
c.firstName, c.balance );
/* move file pointer to correct record in file */
fseek( fPtr, ( account - 1 ) * sizeof( struct clientData ), SEEK_SET );
/* write updated record over old record in file */
fwrite( &c, sizeof( struct clientData ), 1, fPtr );
} /* end else */
} /* end function updateRecord */
/* delete an existing record */