Hey everyone, spot the newbie :D
I know this is probably really simple to you lot but I need a bit of help with some coursework
basically I've got a simple switch which initalises the first part of the code:
after this i have a simple error check to make sure the data is within range:Code:case 1:
printf ("1. Deposit funds \n");
balance = deposited (deposit);
break;
Now when this code comes back into the main part of the program the balance, i was wondering why this is and whats going to be the best way to fix it?Code:float deposited (float balance)
{
float deposit;
float bal = (balance);
printf ("Please enter how much you wish to deposit \n");
scanf ("%f", &deposit);
if ((deposit + balance < 999999) && (deposit + balance > 0))
{
printf ("Thank you %f has being entered into your account \n", deposit);
}
if ((deposit + balance > 999999) && (deposit + balance < 0))
{
printf ("I'm sorry but the number you have entered is either too large or too small/n");
}
balance = deposit + balance;
return balance;
}
Apologies for the shoddily written code but I'm new to this.
Thanks for your help