Explore BrainMass

Practice Program Loops, Simple I/O & Simple Calculations

Need Some Assisstance With A Practice Problem:

Be sure you have access to an ANSI C (not C++) compiler. Code compiles for C++ may or may not be compatible with C.


1. You are to write the basis for what will become, in increments, a small "banking system." This first increment just maintains up to 25 accounts and 0 - 1 million transactions.

2. Store the 25 accounts, including account numbers and balances as an array or arrays, as appropriate.

3. Input will consist of a transaction type (CR for credit and DB for debit), an account number and an amount.

4. You are to (1) initialize the accounts with a zero balance; (2) read in the transactions and adjust the balance of the matching account appropriately; (3) at the end of the program, print out the balances for all accounts.

5. Things to remember:

a) What if the account number on a transaction doesn't match an existing account number?

b) What if an account balance drops below zero? Overdrafts are not allowed.

c) What if the transaction type doesn't match DB or CR?


Solution Preview

Please find attached source code file sample.cpp. Compiled with C option as requested. You can change the MAXACNTS to ...

Solution Summary

This solution assists with practice program loops, simple I/O and other simple calculations.