Unit 06 Test - UNIT6TEST 1.Considerthefollowingprogram:...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
UNIT 6 TEST 1. Consider the following program: float Triple( float fInput ) { float fResult = 0; fResult = fInput*3; return fResult; } void main(void) { float fValue = 0.0; float fAnswer = 0.0; cout << "Enter a number to triple." << endl; cin >> fValue; fAnswer = Triple( fValue ); cout << "The answer is " << fAnswer << endl; return; } Please answer following questions: a. What is the return type of the function? b. What, if any, are the arguments passed to the function c. Which part is the definition of the function? d. Which part indicates calling the function? a) float b) float fInput c) float fResult = 0; fResult = fInput*3; return fResult; d)fAnswer = Triple( fValue ); Triple( fValue ) is calling the function.
Background image of page 1

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

View Full DocumentRight Arrow Icon
2. Create a function called sort. It should take 3 integers as arguments and  have no return value. In the main function, the user enters in 3 integer values  which are then sent to the function which prints them in ascending order. #include <iostream>
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

Unit 06 Test - UNIT6TEST 1.Considerthefollowingprogram:...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online