Dear all,

I m a newbie in C. When do the questions in "C Programming for Absolute Beginners" (MICHAEL VINE, 2008)

When talked about structure programming, there is a question.

Write A function that prints an ATM menu—it receives no
parameters and returns no value.

Void displaymenu()
/*********************
Function Prototypes
*********************/
Int display_balance();
Int deposit_funds();
Int transfer_funds();
Int withdraw_funds();
Int get_available_balance();
Int compare_balance_to_request();
Int update_account();
Int disperse_funds();
Int reject_request();
Int print_receipt();
Int verify_ample_funds_exist();
Int initiate_mechanical_process();
Int update_bank_records();
Int atm_lv1() = 0;
Int atm_lv2() =0;
Int atm_lv3() =0;

main()
    {
    Do 
        {
        System(“Clear”);
        Printf(“\n\t Welcome to ATM\n\n”);
        Printf(“1\tDisplay Balance\n”);
        Printf(“2\tDeposit Funds\n”);
        Printf(“3\tTransfer Funds\n”);
        Printf(“4\tWithdraw Funds\n”);
        Printf(“5\tQuit\n”);
        Printf(“\n\n Choose number\n”);
        Scanf(“%d”, &atm_lv1);
        Switch(atm_lv1) {
            Case 1:
            Int display_balance(); // Suppose another function calling for the account?
            Printf(“Your Balance is”);
            Break;
            Case 2:
            Int Deposit_funds(); //another interface to detect the amount of banknotes?
            Break;
            Case 3:
            Int Transfer_funds(); //Transfer the amount of fund, enter another account
            Break;
            Case 4:
            Int Withdraw_fund();
            Break;
            }
        } while (atm_lv1!=5);
    }// end of ATM level 1
/***************
Function Definition
****************/
//display balance
Int display_balance();
{
    Printf(“Your account balance is”);
}
//disposit fund
Int Deposit_funds();
{
    Printf(“You have deposit to your account”);
}
//transfer fund
Int transfer_funds();
{
    Printf(“You have transferred funds”);
}
//withdraw fund
Int withdraw_funds();
{
    Do 
    {
    System(“Clear”);
    Printf(“\n\t Withdraw funds options \n\n”);
    Printf(“1\tGet Available Balance\n”);
    Printf(“2\tCompare Balance to Request\n”);
    Printf(“3\tUpdate Account\n”);
    Printf(“4\tDisperse Funds\n”);
    Printf(“5\tReject Request\n”);
    Printf(“6\tPrint Receipt\n”);
    Printf(“7\tReturn\n”);
    Printf(“\n\n Choose number\n”);
    Scanf(“%d”, &atm_lv2);
    Switch(atm_lv2) {
        Case 1:
        Int get_available_balance(); 
        Break;
        Case 2:
        Int compare_balance_to_request(); 
        Break;
        Case 3:
        Int update_account (); 
        Break;
        Case 4:
        Int disperse_fund();
        Break;
        Case 5:
        Int reject_request();
        Break;
        Case 6:
        Int print_receipt();
        Break;
        Case 7:
        Int main();
        Break;
        }
    } while (atm_lv2!=8);
}// end of ATM level 2

/***************
Function Definition
****************/
//Get available balance
Int get_available_balance();
{
    Printf(“Your available balance is”);
}
//Compare balance to request
Int compare_balance_to_request();
{
    Printf(“Your balance is compared”);
}
//update account
Int update_account();
{
    Printf(“Your account is updated”);
}
//disperse funds
Int disperse_fund(int);
{
Do 
    {
    System(“Clear”);
    Printf(“\n\t Select the Disperse Funds Action”);
    Printf(“1\tVerify Ample Fund\n”);
    Printf(“2\tInitiate Mechanical Process\n”);
    Printf(“3\tUpdate Bank Record\n”);
    Scanf(“%d”,&atm_lv3);
    Switch(atm_lv3){
        Case 1:
        Int verify_ample_funds_exist();
        Case 2:
        Int initiate_mechanical_process();
        Case 3:
        Int update_bank_records();
    } while(atm_lv3!=4);
} //end of atm lv3
//reject request
Int reject_request(int);
{
    Printf(“Your request is rejected”);
}
//print receipt
Int print_receipt();
{
    Printf(“Your receipt is being printed”);
}
//Verify amply funds
Int verify_ample_funds_exist();
{
    Printf(“Your fund is verified”);
}
//initiate mechanical process
Int initiate_mechanical_process();
{
    Printf(“Mechanical process initiated”);
}
//update bank record
Int update_bank_records();
{
    Printf(“Bank records updated”);
}

Recommended Answers

All 2 Replies

Any incorrect or improvement needed?

Any incorrect or improvement needed?

It's completely broken. I'm fairly confident you didn't attempt to compile that code, much less run it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.