Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
No
Variable
Line
In function
Description
20, 79
int choice
20
int z
22
double wRiver
22
double dFactory
24
double cUnderWater
24
double cOverLand
24&172
double mCost
24&172
double tCost
24&172
double y
conversionFunc ( )
10
24&172
double x
conversionFunc ( )
11
26&199
dFunction ( )
12
26&199
dFunction ( )
13
27
double h1
pipeline ( )
14
27
double h2
pipeline ( )
double
underWaterLength
double
overLandLength
main ( ) &
miniTotalCost ( ) & dFunction ( )
main ( )& inputFunc ( ) &
miniTotalcost ( ) &dFunction ( )
main ( )& inputFunc ( ) &
miniTotalcost ( ) &dFunction ( )
main ( )& costInput( ) & miniTotalcost
( )
main ( )& costInput( ) & miniTotalcost
( )
15
27&220
double length
pipeline ( )
16
27&245
double longest
Pipeline ()
17
216
double width1
Width1_Input ()
18
225
double width2
Width2_Input ()
19
245
doube ab
pipeline ()
20
245
double bc
pipeline ()
21
245
double longest2
Pipeline ()
22
245
int angle
Pipeline ()
No
Line
Functions
Description
16
int main()
This function is the most important function used to receive all functions.
66
displayMenu()
77
getChoice()
To receive the input choice from user and return the value of choice to the main
function
To promote the user to enter the width of river and distance on the other side of the
factory and return those values to the main with reference variable as it is more than
91
inputFunc()
one value and we cannot return more than one value without reference variable.
Otherwise we would need one function for every input variable and this way will
make the code more difficult for user to understand it.
To promote the user to enter the cost under water as well as overland and return
those values to the main with reference variable as it is more than one value and we
122
costInput()
cannot return more than one value without reference variable. Otherwise we would
need one function for every input variable and this way will make the code more
difficult for user to understand it.
To take the values from main as arguments and convert those values from mile to
136
conversionFunc()
feet. After conversion we need to return the values to the main so that we used
reference variables.
170
miniTotalCost()
To transfer the variables from main to the function as argument with 5 parameter
then we used for loop to get the minimum cost , the value of z (missing distance) ,
cost of lying the power under water and over land where the cost is minimum.
8
10
197
dFunction()
211
Width1_Input()
225
Width2_Input ()
Accept variables as arguments, calculate the distance under water and overland
separately and return the distance as total where the cost is minimum.
To promote the user to enter the width of vertical hallway and return the value
entered to the main
To promote the user to enter the width of horizontal hallway and return the value
entered to the main
To receive both width as argument from the main function and calculate the longest
10
243
pipeline()
pipeline as well as the total length of the pipeline and return the total length of the
pipeline.
Section D: output
I.
Menu
II.
IV.
Quit (choice 3)
Overall output