Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is part I, and it works good ------------------------------------------------------------------ #include FILE *inptr, *outptr; const int ARSIZE = 10; const float PI = 3.142593; void fninput(float

image text in transcribed

image text in transcribed

This is part I, and it works good

------------------------------------------------------------------

#include

FILE *inptr, *outptr;

const int ARSIZE = 10; const float PI = 3.142593;

void fninput(float [ ], float [ ]); void fnoutput(float [ ], float [ ]);

int main( ) { float diameter[ARSIZE], velocity[ARSIZE]; inptr = fopen("proj6in.dat", "r"); outptr = fopen("proj6out.dat", "w"); fninput(diameter, velocity); fnoutput(diameter, velocity); return 0; }

/***************************************************************/ /* */ /* ARRAYS INPUT FUNCTION */ /* */ /***************************************************************/

void fninput(float d[ ], float v[ ]) { int i; for(i = 0; i

/***************************************************************/ /* */ /* ARRAYS OUTPUT FUNCTION */ /* */ /***************************************************************/

void fnoutput(float d[ ], float v[ ]) { int i; for(i = 0; i

----

This is for part II which I have some errors.

---

#include

FILE *inptr, *outptr;

const int ARSIZE = 10; const float PI = 3.142593;

void fninput(float [ ], float [ ]); void fncompute(float, float, float); void fnoutput(float [ ], float [ ], float [ ]);

int main( ) { float diameter[ARSIZE], velocity[ARSIZE], volume[ARSIZE]; inptr = fopen("proj6bin.dat", "r"); outptr = fopen("proj6bout.dat", "w"); fninput(diameter, velocity); fncompute(diameter, velocity, volume); fnoutput(diameter, velocity, volume); return 0; }

/***************************************************************/ /* */ /* ARRAYS INPUT FUNCTION */ /* */ /***************************************************************/

void fninput(float d[ ], float v[ ]) { int i; for(i = 0; i

/***************************************************************/ /* */ /* ARRAYS OUTPUT FUNCTION */ /* */ /***************************************************************/

void fnoutput(float d[ ], float v[ ], float z[ ]) { int i; for(i = 0; i

/********************************************************/ /* */ /* AREA OF PIPE */ /* */ /********************************************************/

void fncompute(float d, float v, float z) { int i; for(i = 0; i

/***************************************************************/ /* */ /* ARRAYS OUTPUT FUNCTION */ /* */ /***************************************************************/

void fnoutput(float d[ ], float v[ ]) { int i; for(i = 0; i

Objectives: Learn the following concepts Definition of one-dimensional arrays Input and output of one-dimensional arrays Passing one-dimensional arrays to functions Manipulation of one-dimensional arrays using array index Manipulation of one-dimensional arrays using array pointer THIS IS ATWO PART PROJECT Part I: Manipulate the array through index Part II: Manipulate the array through array pointer Write a C program and the following functions to compute the flow rate of water 1. Function to input into the arrays the pipe diameter and the flow velocity. 2. Function to compute the flow rate in cubic feet per second 3. Function to output the diameter of the pipe in feet, velocity in ft /second, and the flow rate in cubic feet/second NOTE: Use th4e following formulas to compute the cross sectional area and the flow rate in cubic feet per second Cross Sectional Area of Pipe A d2/4 Flow Rate Q A v Where Q is the flow rate in the cubic feet per second A is the cross sectional area in square feet V is the velocity of flow in feet/second Input Data File "Proj6in dat" Diameter of pipe in ft flow velocity in ft/second 2.5 250 6.5 200 4.6 350 580 5.0 400 7.6 150 3.9 280 9.8 320 160 7.9 260

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

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions