Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create CodeBlocks project (C++ console application) 2. Download the binary database file to project folder 3. Copy the skeleton code to the project source file

Create CodeBlocks project (C++ console application) 

2. Download the binary database file to project folder

3. Copy the skeleton code to the project source file (main.cpp)

4. Fill in and complete the blanks for the source code

5. Compile and build the 'plumbing' program

6. Run the program: use the database as the input file (pipes.bin) and output to a text file

The database (input file) is located at http://web.eng.fiu.edu/watsonh/EEL2880/pipesDatabase.html

This is the code so far (in C++):

#include

#include

#include

// set string lengths

#define STRSHORT = 15 chars

#define STRMED = 30 chars

#define STRLONG = 80 chars

usingnamespacestd;

typedefstructcompany

{

charname [STRLONG];

charstreet [STRLONG];

charcity [STRMED];

charstate [STRMED];

charzip [STRSHORT];

charphone [STRSHORT];

charcell [STRSHORT];

intrating;

charcontact [STRLONG];

}

company;

voidprintInfo(company* info, FILE* fp);

intmain()

{

intBlockNumber;

charinput* [STRLONG]; //create an input file name (think up a name)

charoutput* [STRLONG]; //create an output file name

company* info =newcompany;

printf(\"Enter input file name :\");

scanf(\"%s\", input file name );

fflush(stdin); /* flush keyboard buffer */

// open binary data file

if((file pointer = fopen (calling arguments)) ==NULL)

{

fprintf(stderr, \"Error opening input file.\");

exit(1);

}

printf(\"Enter output file name :\");

scanf(\"%s\", output file name );

fflush(stdin); /* flush keyboard buffer */

// open output text file

if( fill in the fopen expression to open the output text file page 2 )

{

fprintf(stderr, \"Error opening output file.\");

exit(1);

}

for(BlockNumber=0; BlockNumber10;>

{

/* Move the position indicator to the specified element. */

if( fill in the fseek expression to position to BlockNumber page 3 )

{

fprintf(stderr, \" Error using fseek().\");

exit(1);

}

/* Read in a single info. */

fread(output*,sizeof(information structure), 1, input*)

fprintf(op,\" Block %d \",BlockNumber); /add header text

printInfo (fill in correct calling arguments);

}

return0;

}

voidprintInfo(fill in calling arguments companyandoutput file pointe)

{

// print all the info values

fprintf (fp,\"Name: %s \",info->name);

fprintf ( fill in correct arguments );

fprintf ( fill in correct arguments );

fprintf ( fill in correct arguments );

fprintf ( fill in correct arguments );

fprintf ( fill in correct arguments );

fprintf ( fill in correct arguments );

fprintf ( fill in correct arguments );

fprintf ( fill in correct arguments );

return;

}




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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions