(Two-dimension Army) Write a program that will compute the flow rate in a set of
ID: 648620 • Letter: #
Question
(Two-dimension Army) Write a program that will compute the flow rate in a set of pipes. Using the following formulae: Where: Flow rate is given by: q = a * v and a = pi d^2/4 Where q is the flow rate in ft^3/sec a is the cross-sectional area of the pipe in ft^2 d is the diameter in ft v is the velocity in ft/sec Please submit your source code and the executable for each program in a single zip file as described in class. Be sure to document your code by providing comments describing the functionality of your program inside your code to receive full credit. Your program must allow the user to input different diameter values in inches and store these values in a 2-dimensional array of 5 rows and 6 columns. The user will also input the velocity value in ft/sec. Your program will compute the flow rate in the pipes and print the table with the diameter values entered by the user and the table with the computed flow rate values. Notice that the formula for cross sectional area uses the value of diameter in feet!Explanation / Answer
#include <iostream>
using namespace std;
int main() {
int diameter[5][6];
int velocity;
for(int i=0;i<=5;i++)
{
for(int j=0;j<=6;j++)
{
//cout<<"enter value for diameter in inches" ;
cin>>diameter[i][j];
}
}
for(int i=0;i<5;i++)
{
for(int j=0;j<6;j++)
{
int d=diameter[i][j];
// pie/4 value =.7854;
// cout<<"enter the value";
//cin>>velocity;
d=d/12;
velocity=90;
double a=d*d*.7485;
double q=a*velocity;
cout<<" "<<q;
}
cout<<" ";
}
// your code goes here
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.