CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2012
    Posts
    0

    Question Beginner needs help with bank atm program, please!!

    By the grace of nice programmers, I ask for help. I learn mostly from example, but I can't figure out how to get started.

    For my class I need to write a source code to simulate an ATM.
    Basically starting with a balance of $5000.
    Entering a user-input loop, give 4 choices
    (withdraw, deposit, show balance, and quit)

    If anyone could help me with going about this, maybe with just one of them (withdraw), that'd be great. And before you suggest using all kinds of advanced methods, I'm suppose to stay in the range of what we've learned so far. Here's how i started it:
    Code:
    ------------------------------------------------------------
    #include <iostream>
    #include <string>
    using namespace std;
    
    int main ()
    {
       //declare variables
       int acct_bal = 5000;
       int choice;
       double withdraw, deposit, balance ;
       
       
       cout << "Your account balance is $" << acct_bal 
            << "\n\nPress (W) if you'd like to withdraw money. \n"
            "Press (D) if you'd like to deposit money. \n"
            "Press (B) to show balance. \n"
            "Press (Q) to exit your account. \n";
            cin >> choice;
       
    if ( choice== "D" || choice== "d" )
    {
       cout << "enter deposit amount";
    
    
       return 0;

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Beginner needs help with bank atm program, please!!

    And before you suggest using all kinds of advanced methods, I'm suppose to stay in the range of what we've learned so far.
    Any advanced methods always start from elementary design. You need to write down in natural language all interactions: how your program starts, communicates with customers and their accounts, and shuts down, every little thing step by step.

    The more advanced technique implies drawing activity/sequence diagrams.
    Best regards,
    Igor

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured