ATM problem

I want to first thank everyone who has helped me. I am finally starting to get this stuff. Thank goodness.

I am working on an ATM problem. We are pulling from a .dat file that has account number (int), code (int), amount (float), and balance (float). This program is designed to do three things. First, if code=1 it's a deposit request, update customer's balance and output their account number and updated balance. If code=2, it's a withdrawal. Check to see if the customer is not withdrawing more then their balance. If so, write out the account number and the message "insufficient funds" and deny it. If they have enough, process the transaction. If a withdrawal results in a new balance being less than $100.00 add an additional $10.00 fee, and display the message "Balance below minimum -- $10.00 fee assessed." For any successful withdrawal, output account number and updated balance. If code is anything other than 1 or 2 display account number and message "Bad Transaction code" After all that is done, you have to do the following, get the total number of deposits made, total amount of the deposits, total number of successful withdrawals, and total amount of the successful withdrawals.
That area is where I am having trouble.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include<fstream>
#include<iostream>
#include<iomanip>
using namespace std;
void main()

{
int acct num, code=0;
float amnt, bal=0;
float deposit, withdrawl, count= 0;
 ifstream fin;
 fin.open(C:\\Users\\Brent McGehee\\Documents\\Programming 1\w3\\Bank.dat")
fin>>account number>>code>>amount>>balance;
while(!fin.eof)
   {
      if(code==1)
         {
            deposit!
         }
      else
         if(code==2)
            {
               withdrawal!
            }
         else  
            {
               bad code
            } 


Now like I said, I am actually starting to understand this stuff. Where I am stuck is in the count area I think. I know I have to calculate the last four things, and also set up for my loop, but I am not sure where to go. Also, I am not sure if I did the int and float part right at the begining. I think they go on separate lines, but I am not sure. One other little question, as far as the names of the terms, account number, code, amount, and balance, I know it will confuse the compiler if I don't have the same variables all through the code. If the dat file has the full names though, do I need to have them in my code?

Thanks again guys!!
Topic archived. No new replies allowed.