Hello all,
I'm new to the board and I'm very desperate for some help with a program I'm writing for class but I can't get rid of the errors in the call by reference functions. I've posted the code below and would be grateful for any help.
Thanks,
Vireyda
Code:#include<stdio.h> //include standard input output functions float Cheque(float balance); float Deposit(float balance); float Print(float balance); void main() { float balance=0; char response; printf("Welcome to the Personal Banker.\n"); printf("Please select a transaction:\n"); printf("Cheque - C or c\nDeposit - D or d\nPrint -P or p\nQuit -Q or q"); scanf("%c", response); switch(response) {case'c':case'C': Cheque(&balance); break; case 'd': case'D': Deposit(&balance); break; case 'p': case'P': Print(&balance); break; case 'q': case'Q': break; default: printf("That is an invalid selection. Please try again. "); } } void Cheque (float &balance) { float amount=0; printf("Please enter the amount of the cheque. $"); scanf ("%f",amount); if (amount>balance) printf ("There are insufficient funds to process this cheque."); else balance=-amount; } void Deposit (float &balance) { float amount=0; printf ("Please enter the amount of deposit. $"); scanf ("%f",amount); balance=+amount; } void Print (float balance) { printf ("The balance of your account is $%.2f.", balance); }



LinkBack URL
About LinkBacks


