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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
#include "Account.h"
#include <iostream>
#include <fstream>
#include <cstdlib> // for exit function
using std::ofstream;
int main() {
ofstream outdata;
const int SIZE = 6; //This is generally a bad idea in C++.
//Even though this is hardcoded, to add function and flexibility, I would use a vector.
Account Account_array[SIZE] = { Account(832442, 560.10, .02),
Account(832443, 1020.58, .04),
Account(832444, 78.00, .02),
Account(832447, 1200.12, .04),
Account(832449, 489.33, .02),
Account(833001, 105.74, .02) };
//This is actually bad practice. Instead of hardcoding 6 here, use SIZE.
//for (int x=0; x<6; x++)
for (int x = 0; x < SIZE; ++x)
{
Account_array[x].account_details();
//I have no clue what this function does.
}
ofstream file ("AccountDetail.data");
if(!file)
{
cerr<<"ERROR"<<endl;
exit(0);
}
//Is this the function that outputs details using file?
//If so, why don't you post this so I can give your more details on what your doing wrong.
Account_array[SIZE].account_OutPutdetails(file);
file.close();
cin.ignore();
cin.get();
return 0;
}
|