Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include #include / / exit function prototype #include ClientData.h / / ClientData class definition using namespace std; void outputLine ( ostream& ,

#include
#include
#include
#include // exit function prototype
#include "ClientData.h"// ClientData class definition
using namespace std;
void outputLine( ostream&, const ClientData & ); // prototype
int main()
{
ifstream inCredit( "credit.dat", ios::in | ios::binary );
// exit program if ifstream cannot open file
if (!inCredit )
{
cerr << "File could not be opened." << endl;
exit( EXIT_FAILURE );
}// end if
// output column heads
ClientData client; // create record
int r;
cout << "Enter record to read ";
cin >> r;
inCredit.seekg (sizeof(ClientData)*(r-1), ios::cur);
// read first record from file
inCredit.read( reinterpret_cast< char *>( &client ),
sizeof( ClientData ));
cout << left << setw(10)<< "Account" << setw(16)
<< "Last Name" << setw(11)<< "First Name" << left
<< setw(10)<< right << "Balance" << endl;
outputLine( cout, client );
// read next from file
#include
#include
#include
#include // exit function prototype
#include "ClientData.h"// ClientData class definition
using namespace std;
void outputLine( ostream&, const ClientData & ); // prototype
int main()
{
ifstream inCredit( "credit.dat", ios::in | ios::binary );
// exit program if ifstream cannot open file
if (!inCredit )
{
cerr << "File could not be opened." << endl;
exit( EXIT_FAILURE );
}// end if

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

Why do some people resist change?

Answered: 1 week ago