#include #include using namespace std; // Create our own bank account data type: struct acct_type { int num; // account number (e.g. 12345) string name; // account owner's name double balance; // $$$$$$$$$ }; void display_account( acct_type a ) { // display account information: cout << "ACCOUNT SUMMARY\n---------------------\n"; cout << "Account #" << a.num << endl; cout << "Owner: " << a.name << endl; cout << "Balance: $" << a.balance << endl; cout << "---------------------" << endl << endl; // Changes here do NOT affect variable a1 in main() // (i.e. pass-by-value) a.balance += 1; } int main() { acct_type a1; // data-type variable-name a1.num = 12345; a1.name = "Goldschmidt"; a1.balance = 0.155; acct_type a2; a2.num = 12346; a2.name = "Fox"; a2.balance = 0; // display exactly two digits after the decimal point cout.setf( ios_base::fixed ); cout.precision( 2 ); // round if necessary display_account( a1 ); display_account( a2 ); display_account( a1 ); // deposit money into account a1 double amount; cout << "Please enter deposit amount: "; cin >> amount; a1.balance += amount; display_account( a1 ); // TO-DO: create deposit() function // also add: withdraw(), balance_xfer(), // accrue_interest() // create an array of bank accounts: acct_type accounts[10]; // set up the 4th account info: accounts[3].num = 23456; accounts[3].name = "Smith"; accounts[3].balance = 42393.49; display_account( accounts[3] ); return 0; }