how can i display all the account numbers that have been entered.
it only shows the last account number entered, not any before it.

heres the code-

#include <iostream>

using namespace std;

int main()
{
    double deposit;
    double previous;
    double newtotal;
    double withdraw;



    int total;
    int number;
    int res;

    total = 0;



    cout << " WELCOME TO MSIBANK " << endl;
    cout  << endl;

    cout  << "Enter 1 to process an account or 0 to stop" << endl;
    cin >> res;

    while(res == 1)
    {
        cout  << "Enter account number please" << endl;
    cin >> number;
    cout  << " Enter present amount in account: " << endl;
    cin >> previous;
    cout << " Enter deposit amount: " << endl;
    cin >> deposit;
    cout << "Enter withdraw amount: " << endl;
    cin >> withdraw;

    newtotal = previous - withdraw + deposit;


    cout << " Previous total: " << previous << endl;
    cout  << " Deposit amount: " << deposit << endl;
    cout  << " Withdraw amount: " <<  withdraw << endl;
    cout << endl << endl;
    cout << "--------------------------------------------------" << endl;
    cout  << " Present total: " << newtotal << endl;




    ++total;


     cout  << "Enter 1 to process an account or 0 to stop" << endl;
    cin >> res;

    }
      cout << "---------------------------------------" << endl;
      cout << " Acount numbers: " << number << endl;
      cout << " Total accounts processed: " << total;

    }

You will have to maintain an array of account numbers. In certain circumstances a programming teacher may accept a statically allocated array--when learning the basics of programming.

If you don't know how to use arrays, I suggest you learn how. Truthfully there are (probably) infinite ways to accomplish the task, however.

thanks for your help i appreciate 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.