Mark
2010-09-05 13:37:10 UTC
Please, if you know C Language, please tell me what's wrong.
#include
#pragma warning(disable:4996)
void explanation();
double deposit();
double withdrawl();
double results();
double finish();
void print_results();
void main (void)
{
int total = 0.0;
int n;
char x;
int dep;
int wit;
explanation();
printf("Please enter the old balance: ");
scanf("%d", &n);
printf("The current total is %d\n\n", n);
printf("Enter the transactions now.\n");
printf("Enter an F for the transaction type when you are finished.\n\n");
printf("Transaction Type (D=deposit, W=withdrawl, F=finished): \n ");
scanf("%c", &x);
if(x=='D')
deposit(dep, n);
if(x=='W')
withdrawl(wit, n);
if(x=='F')
finish();
total = n;
printf("Your ending balance is: %d", n);
}
double deposit(double dep, double n)
{
double result;
printf("\n Amount: ");
scanf("%d", &dep);
result = dep + n;
return result;
}
double withdrawl(double wit, double n)
{
double result;
printf("\n Amount: ");
scanf("%d", &wit);
result = n - wit;
return result;
}
double finish( void )
{
printf("Your final total is: ");
return 0;
}
void explanation()
{
printf("Written by Mark Mansur. \n");
printf("This program allows the user to input an initial balance, \n");
printf("then deposit or withdraw any number of dollars, \n");
printf("then end the program by typing in 'f'. \n\n");
printf("BANK ACCOUNT PROGRAM \n");
printf("-------------------- \n");
}