Hello All,
I'm having a problem compiling my code and I can't see why...can someone please have a look and see what I might be doing wrong? Also my compiler is spitting out the following:
[machine1@cels15 9075 milasp5.c]% gcc milasp5.c
one.c: In function ‘displayBankRec ord’:
one.c:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
Thanks for your consideration
I'm having a problem compiling my code and I can't see why...can someone please have a look and see what I might be doing wrong? Also my compiler is spitting out the following:
[machine1@cels15 9075 milasp5.c]% gcc milasp5.c
one.c: In function ‘displayBankRec ord’:
one.c:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
Thanks for your consideration
Code:
#include <stdio.h> float get_startingbalance(void); float getCntOfWithdrawls(); float getCntOfDeposits(); float getEachDeposit(); float getEachWithdrawl(); float checkBalance(); float calcAndDisplayBalance(); float displayBankRecord() int main() { /* Declare Variables */ float deposits[50] = {0}; float withdrawals[50] = {0}; char first_name[20] = {0}; int num_withdrawals, num_deposits, x; float start_bal; float current_balance = 0; float total_deposits = 0; float total_withdrawals = 0; float balance; /* Output initial greeting */ printf("Welcome to the Banking System.\n\n"); printf("Please enter your first name: "); scanf("%s", &first_name); fflush(stdin); printf("\nHello, %s.\n\n", first_name); /* GET STARTING BALANCE */ float get_start_balance() { float start_bal do { printf("%s, Please enter your current balance in dollars and cents: "); /* Prompt user for current balance. */ scanf("%f", &start_bal); fflush(stdin); if (start_bal < 0) printf("Invalid entry. Starting balance must be at least zero!\n\n"); } while (start_bal < 0); return start_bal; } /* end function get starting balance */ /* GET NUMBER OF WITHDRAWALS */ float getCntOfWithdrawls() { float num_withdrawls do { printf ("\nEnter the number of withdrawals: "); scanf ("%i", &num_withdrawals); printf ("\n"); fflush (stdin); if (num_withdrawals < 0 || num_withdrawals > 50) printf ("Error: Number of withdrawals must be between zero and 50, please re-enter!\n\n"); } while (num_withdrawals < 0 || num_withdrawals > 50); return num_withdrawls; } /* end function number of withdrawls */ /* GET NUMBER OF DEPOSITS */ float getCntOfDeposits() { float num_deposits do { printf ("Enter the number of deposits: "); scanf ("%i",&num_deposits); printf ("\n"); fflush (stdin); if ( num_deposits < 0 || num_deposits > 50) printf ("Error: Number of deposits must be between 0 and 50, please re-enter!\n\n"); } while (num_deposits < 0 || num_deposits > 50); /* end do-while loop */ return num_deposits; } /* end function number of deposits */
Comment