The user should be allowed to enter a begining balance and the transaction one at a time. When the transaction is a deposit, the user precedes the transaction with "D" and withdrawal with "W" and a check with "C" and should include the check number. The program should report all transactions and the final balance.
Im new to this but anyways this is what I have :
/*      bankstatement.c
 *
 * Synopsis - Displays a menu, accepts a chioce for a user, and processes the response.
 *
 * Objective - Illustrates the switch statement;
 */
/* Include Files */
#include %26lt;stdio.h%26gt;
/* Constant Definitions */
#define BUF_SIZE 40
/* Fnction Prototypes */
void processresponse (char iochar );
/* PRECONDITION: amount can be any interger value
 * POSTCONDITION: Compares iochar with the case labels and takes action sccordingly.
 *
 */
int main (void);
/* PRECONDITION: none
 *
 * POSTCONDITION: Displays the menu choices and accepts input of the user's response. The first cahrachter of the
 *      response is returned
int main (void)
{
        char iochar = 0;
do{
        iochar = menu();
        processresponse(iochar);
        }
        while ( iochar != "0" );
        return 0;
}
/***********************************me...
int menu (void)
int menu (void)
(
        int check;
        int trans;
        int D,W,C,Q;
        int enter;
printf("XYZ Bank Statement Program \n");
printf("------------------------------...
printf(" Enter your beginiing balance:\n")
scanf("%d", %26amp;enter );
printf(" Enter which transaction you would like to complete:
        (W)ithdrawal, (D)eposit, (C)heck, (Q)uit:\n");
        scanf("%d", %26amp;trans);
        if(trans = D)
        printf("%26amp;d\n", trans + enter );
        else if ( trans = W)
        printf("%d\n", trans - enter);
        else if ( trans = C)
        printf("Check number:\n");
        scanf("%d", %26amp;check);
 }
)
void processresponse(char iochar)
{
        switch(iochar){
        case'D': printf("Amount: %d\n",trans);
        case'W': printf("Amount: %d\n",trans);
        case'C': printf("Check number%d, Amount:%d\n",check, trans);
        }
}
 }
 return (trans);
}
I need help with a C program im  trying to write?
If you are still stuck , may be you can contact a c expert at websites like http://askexpert.info/
Subscribe to:
Post Comments (Atom)
 
No comments:
Post a Comment