The program that I want to do is a program that lets you deposit and withdraw money, and that it can display the total amount that you have inputted in the transaction.
Now my problem is, I don't know how to display the total amount and how to do a loop so that I can continuously deposit and withdraw money. Please Help me.
Here is the Code that I have done so far.
#include<stdio.h>
#include<stdlib.h>
int main()
{
int option, a;
float deposit, withdraw, accountbal[10], totalbalance;
do
{
system("cls");
printf("\n\t=====================================");
printf("\n\t M's ATM Machine");
printf("\n\t=====================================");
printf("\n\n\tWhat Would You Like To Do?");
printf("\n\n\tMake a Deposit .......................... [1]");
printf("\n\n\tMake a Withdrawal ....................... [2]");
printf("\n\n\tView Account Balance .................... [3]");
printf("\n\n\tExit the program......................... [0]");
printf("\n\n\tEnter Option: ");
scanf("%d",&option);
switch(option)
{
case 1:
system("cls");
printf("How much would you like to deposit?\n\n");
printf("Please Enter the Value Here: ");
scanf("%f", &deposit);
if (deposit >= 10000)
{
printf("\n\nOnly able Deposit a Maximum of $10000.00.\nPlease Try Again. \n\n");
printf("Press any key to Continue...");
fflush(stdin);
getchar();
break;
return 0;
}
break;
case 2:
system("cls");
printf("How much would you like to Withdraw?\n\n");
printf("Please Enter the Value Here: ");
scanf("%f", &withdraw);
if (withdraw >= 5000)
{
printf("\n\nYou are Only able withdrawal a Maximum of $500.00.\nPlease Try Again. \n\n");
printf("Press any key to Continue...");
fflush(stdin);
getchar();
break;
return 0;
}
break;
case 3:
system("cls");
printf("Your Account Balance as of today is: \n\n");
printf("%f", &totalbalance);
printf("\n\nPress any key to Continue...");
break;
case 0:
printf("\n\n\tThank You for Using Melvin's ATM Machine!... ");
break;
default:
printf("\n\n\tWrong Choice!");
printf("\n\n\tPress Enter To Start Again ... ");
fflush(stdin);
getchar();
break;
}
}while(option!= 0);
return 0;
for (a=0;;a++);
{
accountbal[a] = deposit - withdraw;
totalbalance = totalbalance + accountbal[a];
}
}