306-135� Introduction to
Programming
Quiz 6 - 10/21/99
Name:� ����������������������������������������������������������������������
a)� True���������������������� b)
False
a)� True���������������������� b)
False
is a call the function whose definition can be found
below.� Rewrite the function as a
value-��
returning function, then write a function call that
assigns the function value to the variable m.
void power (float base, ��� ���//
IN:� the base to be raised to a power
������������ int exponent,� �� //
IN:� the power that the base will be
raise to�
������������ float& answer) // OUT: the
result from raising the base to power of the exponent
���� {
int i;
answer = 1.0;
i = 1;
while (i <= exponent)
{
����������� answer
= answer * base;
����������� i++;
}
}
Answer:���
float
power (float base,� ����������//IN: :� the base to be raised to a power
������������ ���������� ���int exponent)������ //
IN:� the power that the base will be
raise to�
{
����������� float
answer = 1.0;
i = 1;
while (i <= exponent)
{
����������� answer
= answer * base;
����������� i++;
}
return answer;
}
Function call:� ����������� m = power (k,l)����������������������������������������������������������������������������������