Web Design and Web Development Forum

  1. #1
    Join Date
    Jan 2010
    Posts
    2
    Rep Power
    0
  2. vilya is on a distinguished road
  3. Exclamation atm program

    Hi!!Can smeone help me with an atm program in C :?: Im new in programming so i have some problems:\
    Reply With Quote Reply With Quote
  4. #2
    vento's Avatar
    Join Date
    May 2009
    Location
    Lithuania
    Age
    18
    Posts
    185
    Rep Power
    3
  5. vento is on a distinguished road
  6. Re: atm program

    What task exactly? And what have you already got about it?

    How to set up portable C++ IDE (Dev-C++)

    Writing in C or C++ is like running a chain saw with all the safety guards removed," — Bob Gray.
    Reply With Quote Reply With Quote
  7. #3
    Join Date
    Jan 2010
    Posts
    2
    Rep Power
    0
  8. vilya is on a distinguished road
  9. Re: atm program

    well i have to make a prog which must ask to type the code and read it(the code is given) and then there will be 4 options 1 deposit money 2 withdraw money 3 show balance and 4 exit
    you dont need to keep any data
    Reply With Quote Reply With Quote
  10. #4
    vento's Avatar
    Join Date
    May 2009
    Location
    Lithuania
    Age
    18
    Posts
    185
    Rep Power
    3
  11. vento is on a distinguished road
  12. Re: atm program

    Yes, but ATM program is supposed to connect to the bank server or something, doesn't it? That's a different thing. The thing that you said is pretty simple I guess.

    If you're using C++:
    --use cin to read the code (string probably, or int, depends on the password).
    --then you should connect to the server and check if the password is correct.
    I haven't done this and don't know how do banks connect to the server. Probably using sockets with some special protocol.
    --if it returns that the password is correct, you show the menu. Menu should be held in a function or a file. File is a pretty nice option. it would look like this:
    Code:
    1. Deposit money
    2. Withdraw money
    3. Show balance
    4. Exit
    Of course you should mark where each section goes. You can do this by setting special states (probably int value) to each selection. For example state 1 would be the main menu, state 2 would be deposit menu and so on.
    Now the full file would look like this: (comments are for you to understand easier, it shouldn't be there)
    Code:
    4 //number of options. Makes things easier
    2 //4 numbers meaning the state to go after selecting
    3 //the order and actually numbers may differ, of course.
    4
    5 //next the same 4 lines. It should be read like a full string
    1. Deposit money //using getline(), probably.
    2. Withdraw money
    3. Show balance
    4. Exit
    I really don't know what else to explain, it look pretty simple.
    If needed, you can read more about sockets.

    Actually I don't know why are you making this. I believe you're not a professional programmer making a client for bank. You're probably trying to learn the language, aren't you? This is not a good way. this program is going to end up like lots of menus and nothing more. Nothing fun or cool.

    My suggestion would be making some algorithm. Like the ones in Usaco (link) the ones at the beginning are really simple.
    If you want - you can create some text based games. It was pretty fun to me (when I just started coding). My first game was a snake, it's really simple to make one, no need for a project - I created it in one file :D What do I mean by text-based? For example food is 'x' and snake head is 'O' and the whole body is 'o' :) You can make other, graphical, games if you want, but first understand the language.

    How to set up portable C++ IDE (Dev-C++)

    Writing in C or C++ is like running a chain saw with all the safety guards removed," — Bob Gray.
    Reply With Quote Reply With Quote

Similar Threads

  1. Using an excel file in a C++ program
    By andy_cullen in forum C and C++ Programming
    Replies: 3
    Last Post: 08-14-2009, 10:27 AM
  2. chess program
    By pops in forum C and C++ Programming
    Replies: 2
    Last Post: 08-29-2007, 05:24 PM
  3. C++ or C better program
    By ChrisBrown in forum C and C++ Programming
    Replies: 0
    Last Post: 08-28-2007, 09:47 AM
  4. ip/DNS program
    By mr.disco in forum C and C++ Programming
    Replies: 2
    Last Post: 12-27-2005, 11:46 AM
  5. what does this mean --> cc++/Socket.h???
    By AsianCutie in forum C and C++ Programming
    Replies: 15
    Last Post: 06-27-2005, 12:47 AM