Turn up the warning level on your compiler.
Code:
#include <stdio.h>
float deposited (float);
float withdawn (float);
/* [Info 752] local declarator 'withdawn(float)' not referenced */
int main()
{
int menu_choice = 0;
float deposit = 0;
float withdraw = 0;
int transactions;
float balance, new_balance;
while ( menu_choice != 4 )
{
printf ("Your current balance = %.2f \n", balance);
/* [Warning 530] Symbol 'balance' not initialized */
printf ("1. Deposit funds \n");
printf ("2. Withdraw funds \n");
printf ("3. Show balance \n");
printf ("4. Quit Program \n");
printf ("Please select what you wish to do (1-4): \n");
scanf ("%d", &menu_choice);
switch ( menu_choice )
{
case 1:
printf ("1. Deposit funds \n");
balance = deposited (balance);
transactions ++;
/* [Warning 530] Symbol 'transactions' not initialized */
break;
case 2:
printf ("2. Withdraw funds \n");
balance = withdrawn (balance);
/* [Info 718] Symbol 'withdrawn' undeclared, assumed to return int */
/* [Info 746] call to function 'withdrawn()' not made in the presence of a prototype */
break;
case 3:
printf ("3. Show balance \n");
printf ("Your current balance = %.2f \n", balance);
break;
case 4:
printf ("Exiting... \n");
break;
default:
printf("Please Enter a Choice from 1-4\n" );
break;
}
}
return 0;
/* [Warning 550] Symbol 'transactions' not accessed */
/* [Warning 529] Symbol 'deposit' not subsequently referenced */
/* [Warning 529] Symbol 'new_balance' not subsequently referenced */
/* [Warning 529] Symbol 'withdraw' not subsequently referenced */
}
float deposited (float balance)
{
float deposit;
printf ("Please enter how much you wish to deposit \n");
scanf ("%f", &deposit);
if ( (deposit + balance < 999999) || (deposit + balance > 0) )
{
balance = balance + deposit;
printf ("Thank you %.2f has been entered into your account\n", deposit);
}
else
printf ("I'm sorry but the number you have entered out of range/n");
return(balance);
}
float withdrawn (float balance)
/* [Error 18] Symbol 'withdrawn()' redeclared (basic, Arg. no. 1: promotion) conflicts with line 37 */
/* [Warning 516] 'Symbol withdrawn(float)' has arg. type conflict (arg. no. 1 -- float vs. double) with line 37 */
{
float withdraw = 0 ;
int transtype;
printf ("Please enter how you wish to withdraw \n");
printf ("1. Cash \n");
printf ("2. Cheque\n");
scanf ("%d", &transtype);
if ( transtype = 2 )
/* [Info 720] Boolean test of assignment */
/* [Warning 506] Constant value Boolean */
/* [Info 774] Boolean within 'if' always evaluates to True */
{
printf ("Please enter how a value up to a maximum of 500 \n");
scanf ("%f", &withdraw);
if ( withdraw > 500 )
printf ("You are limited to a maximum of 500 \n");
else
{
printf ("%.2f has being withdrawn from your account \n", withdraw);
balance = balance - withdraw;
}
}
return(balance);
}