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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
#include "AccountData.h"
#include <iostream>
#include<fstream>
#include <string>
#include <stdio.h>
#include <iomanip>
using namespace std;
void accountData::writeAccount()
{
accountData ac;
ofstream outFile;
outFile.open("account_information.dat", ios::binary | ios::app);
ac.customerInfo();
outFile.write(reinterpret_cast<char*>(&ac), sizeof(accountData));
outFile.close();
}
void accountData::customerInfo()
{
cin.clear();
cin.sync();
//------------------------------ACCOUNT NUMBER------------------------------
system("CLS");
cout << "Enter available account number: ";
cin >> accountNumber;
// -------------------------------NAME---------------------------------------
system("CLS");
cout << "Customer Full name: ";
cin.ignore();
cin.get(name, 50);
cout << name << endl;
system("pause");
system("CLS");
//------------------------------DATE OF BIRTH--------------------------------
cout << "Enter Birth Month (MM):";
cin >> MM;
cout << "\nEnter birth Day (DD): ";
cin >> DD;
cout << "\nEnter Birth Year (YYYY): ";
cin >> YYYY;
system("CLS");
//n = sprintf_s(DOB, "%d/%d/%d", MM, DD, YYYY);
//printf("%s\n", DOB, n);
//------------------------------Address-------------------------------------
system("CLS");
cout << "Enter the customers full address: ";
cin.ignore();
cin.get(address, 100);
cout << endl << address;
system("pause");
//------------------------------Phone #-------------------------------------
system("CLS");
cout << "Enter the customers Phone number: ";
cin.ignore();
cin.get(phoneNumber, 20);
cout << endl << phoneNumber;
system("pause");
//------------------------------SSN-----------------------------------------
system("CLS");
cout << "Enter the customers Social Security Number: ";
cin.ignore();
cin.get(SSN, 15);
cout << endl << SSN;
system("pause");
system("CLS");
//cout << "Customer Info: " << name << endl << address << endl << phoneNumber << endl << SSN << endl;
//printf("%s\n", DOB, n);
}
void accountData::allAccounts()
{
accountData ac;
ifstream inFile;
inFile.open("account_information.dat", ios::binary);
if (!inFile)
{
cout << "No Data available!\n";
return;
}
cout << "====================-HOLDER LIST-======================\n";
while (inFile.read(reinterpret_cast<char*> (&ac), sizeof(accountData)))
{
ac.dataBase();
}
inFile.close();
}
void accountData::dataBase()
{
cout << accountNumber << " " << name << " " << MM << "/" << DD << "/" << YYYY << " " << address << " " << phoneNumber << " "<< SSN << endl;
}
| |