LE1 (SequentialProgStruct 4Q1516)
LE1 (SequentialProgStruct 4Q1516)
Exercise #
Name Login/ Username
(Telephony) In a directly connected telephone network, all telephones are connected and don’t
require a central switching station to establish calls between two telephones. The number of lines
needed to maintain a directly connected network for n telephones is given by this formula:
Example: n=4
number of lines needed = 6
n = 100
number of lines needed = 4950
Write, compile and run a C++ program that displays the following prompts:
Enter the miles driven:
Enter the gallons of gas used:
After each prompt is displayed, your program should use a cin statement to accept data from the
keyboard for the displayed prompt. After the number of gallons of gas used has been entered,
your program should calculate and display the miles per gallon (mpg). This value should be
included in a message and calculated by using the formula miles per gallon = miles / gallons
used. Verify your program by using the following test data:
250 16.00
275 18.00
312 19.54
296 17.39
Laboratory Exercise Score Sheet
Criteria Score
Total 100
_________________________ _______________
Engr. Cristina A. Pascua Date
(Instructor)
Answer Sheet
To be uploaded in blackboard
1.)
C++ Program
2.)
C++ Program