Most of the warnings were addressed. The program is functioning better now but look at this portion of the code and tell me if there are any obvious faults.
Code:
void deposit()
{
FILE*cfptr;
cust_data cData ={0,0.0,"","","",0.0,0.0};
float deposit;
int acc_num;
cfptr=fopen("MasterMode.txt","r+");
printf("\nPlease enter the account number you wish to deposit to\n");
printf("---> ");
scanf("%d",&acc_num);
fseek(cfptr,(acc_num-1)*sizeof(cust_data), SEEK_SET);
fread(&cData,sizeof(cust_data),1,cfptr);
if ((cData.acc_num !=0)||(cData.acc_num!=NULL))
{
textcolor(LIGHTCYAN);
cprintf("\nPlease enter the amount you wish to deposit\n$");
scanf("%f",&deposit);
cData.curr_bal +=deposit;
cprintf("Your current balance is %.2f",cData.curr_bal);
}//end of if
else {
printf("Invalid account number");
textcolor(WHITE);
cprintf("\r\nReturning to menu....");
mainMenu();
sleep(2);
}//end of else
The files were created and written to with customer data. Using the deposit function, the extra amount is not added successfully to the initial account balance.