I am having trouble creating the void functions and assigning the pointers so that I can have a running balance for the checking and savings balances.
insert
Code:
#include <stdio.h>
void add_acc();
void deposit(savings, depositAmount);
void withdrawal(savings, withDrawalAmount);
void transfer(transfer, transFer, savings, checking, transferAmount);
void acc_info();
void transaction();
int main()
{
int choice;
float accountBalance, depositAmount =0, withDrawalAmount, savingsBalance, checkingBalance, transferAmount;
char Exit;
double *savings, *checking;
savings = &savingsBalance;
checking = &checkingBalance;
Exit = 'N';
while (Exit = 'N')
{
printf("1. Create New Account\n");
printf("2. Cash Deposit\n");
printf("3. Cash Withdrawl\n");
printf("4. Fund Transfer\n");
printf("5. Account Information\n");
printf("6. Transaction Information\n");
printf("7. Exit\n");
printf("\n");
printf("Press a choice between the range of [1-7]");
scanf_s("%d", &choice);
switch (choice)
{
case 1:
printf("Adding a new account is not possible at this time:\n ");
scanf_s("%d", &choice);
break;
case 2:
printf("Process a cash deposit.\n");
printf("Enter the current account balance\n");
scanf_s("%f", &savings);
printf("Enter the amount of the deposit\n");
scanf_s("%f", &depositAmount);
printf("Your new balance is: $%.2f\n", deposit);
scanf_s("%.2f", &savings);
break;
case 3:
printf("Process a cash withdrawal.\n");
printf("The current savings account balance is: %.2f \n", savings);
printf("Enter the amount to be withdrawn\n");
scanf_s("%f", &withDrawalAmount);
printf("The new balance is: $%.2f\n", withdrawal);
break;
case 4:
printf("Transfer funds from savings to checking.\n");
printf("The current savings account balance is %.2f \n", savings);
printf("Enter the current checking account balance\n");
scanf_s("%f", &checkingBalance);
printf("Enter the amount to be transferred\n");
scanf_s("%f", &transferAmount);
printf("The new savings account balance is: $%.2f\n", transfer);
printf("\n");
printf("The new checking account balance is: $%.2f\n", transFer);
break;
case 5:
printf("Customer account balances.\n");
printf("Your savings account balance is: $%.2f", savings);
printf("Your checking account balance is: $%.2f", checking);
break;
case 6:
printf("There is no transaction history availavle at this time.\n");
scanf_s("%d", &choice);
break;
case 7:
printf("Are you sure you want to exit, Y-yes:N-no:");
scanf_s(" %c", &Exit);
if (Exit == 'Y' || Exit == 'y')
{
return 0;
}
break;
default:
printf("That wasn't 1-7... Please re-enter a number between (1-7)\n");
break;
}
}
return 0;
}
void deposit(double savings, float depositAmount)
{
return savings + depositAmount;
}
void withdrawal(double savings, float withDrawalAmount)
{
return savings - withDrawalAmount;
}
void transfer(transfer, transFer, savings, checking, transferAmount )
{
if (transfer)
{
return savings - transferAmount;
}
else (transFer);
{
return checking + transferAmount;
}
}