SOLUTION_2

# SOLUTION_2 - CS 31: Introduction to Computer Science I: / /...

This preview shows pages 1–2. Sign up to view the full content.

CS 31: Introduction to Computer Science I: Winter 2010: Project 2 Solution Page 1 // UCLA Winter 2010 // CS 33 Project 2 // John A. Rohr // January 9, 2010 // // // Pipe Flow Rate Calculator // // This program calculates the flow rate through distribution pipes // fed from a main pipe. // // The program first displays a title and a blank line. // // Then the program prompts for and accepts the feed pipe flow rate, // the flow rate unit, and the diameters of each of three distribution // pipes. Invalid inputs are rejected with an error message and // program termination. // // Then the program calculates the flow rate through each of the distribution // pipes and displays the results of the calculations. The flow rate through // each of the distribution pipes is assumed to be proportional to the // cross-sectional area of each of the pipes. // // Finally the program displays a blank line and a termination message. #include <iostream> #include <string> using namespace std; int main() { double feedPipeRate; // Feed pipe flow rate double pipe1Diameter; // Distribution pipe 1 diameter double pipe2Diameter; // Distribution pipe 2 diameter double pipe3Diameter; // Distribution pipe 3 diameter double pipe1Factor; // Distribution pipe 1 area factor double pipe2Factor; // Distribution pipe 2 area factor double pipe3Factor; // Distribution pipe 3 area factor

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 03/08/2010 for the course COM SCI 31 taught by Professor Kinsey during the Spring '98 term at UCLA.

### Page1 / 5

SOLUTION_2 - CS 31: Introduction to Computer Science I: / /...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online