⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 page_454.html

📁 Programming and Problem Solving with C++
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">	<html>		<head>			<title>page_454</title>			<link rel="stylesheet" href="reset.css" type="text/css" media="all">			<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />		</head>		<body>		<table summary="top nav" border="0" width="100%">			<tr>				<td align="left" width="30%" style="background: #EEF3E2"><a style="color: blue; font-size: 120%; font-weight: bold; text-decoration: none; font-family: verdana;" href="page_453.html">&lt;&nbsp;previous page</a></td>				<td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_454</strong></td>				<td align="right" width="30%" style="background: #EEF3E2"><a style="color: blue; font-size: 120%; font-weight: bold; text-decoration: none; font-family: verdana;" href="page_455.html">next page&nbsp;&gt;</a></td>			</tr>					<tr>				<td align="left" colspan="3" style="background: #ffffff; padding: 20px;">    <table border="0" width="100%" cellpadding="0"><tr><td align="center">  <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr><td align="left"></td>  <td align="right"></td>  </tr></table></td></tr><tr><td align="left"><p></p><table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td align="right"><font face="Times New Roman, Times, Serif" size="2" color="#FF0000">Page 454</font></td></tr></table><table border="0" cellspacing="0" cellpadding="0"><tr><td rowspan="5"><img src="3e26ecb1b6ac508ae10a0e39d2fb98b2.gif" border="0" width="24" height="1" alt="3e26ecb1b6ac508ae10a0e39d2fb98b2.gif" /></td>  <td colspan="3" height="12"></td>  <td rowspan="5"></td></tr><tr><td colspan="3"></td></tr><tr><td></td>  <td><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">void聽Power(聽float聽聽base,<br />聽聽聽聽聽聽聽聽聽聽聽聽int聽聽聽聽exponent,<br />聽聽聽聽聽聽聽聽聽聽聽聽float&amp;聽answer聽聽聽)<br />{<br />聽聽聽聽int聽i;<br /><br />聽聽聽聽answer聽=聽1.0;<br />聽聽聽聽i聽=聽1;<br />聽聽聽聽while聽(i聽&lt;=聽exponent)<br />聽聽聽聽{<br />聽聽聽聽聽聽聽聽answer聽=聽answer聽*聽base;<br />聽聽聽聽聽聽聽聽i++;<br />聽聽聽聽}<br />}</font></td><td></td></tr><tr><td colspan="3"></td></tr><tr><td colspan="3" height="1"></td></tr></table><table border="0" cellspacing="0" cellpadding="0"><tr><td rowspan="5"></td>  <td colspan="3" height="12"></td>  <td rowspan="5"></td></tr><tr><td colspan="3"></td></tr><tr><td></td>  <td><font face="Times New Roman, Times, Serif" size="3">9. You are given the following </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">Test</font><font face="Times New Roman, Times, Serif" size="3"> function and a C++ program in which the variables </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">a</font><font face="Times New Roman, Times, Serif" size="3">, </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">b</font><font face="Times New Roman, Times, Serif" size="3">, </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">c</font><font face="Times New Roman, Times, Serif" size="3">, and </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">result</font><font face="Times New Roman, Times, Serif" size="3"> are declared to be of type </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">float</font><font face="Times New Roman, Times, Serif" size="3">. In the calling code, </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">a</font><font face="Times New Roman, Times, Serif" size="3"> = -5.0, </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">b</font><font face="Times New Roman, Times, Serif" size="3"> = 0.1, and </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">c</font><font face="Times New Roman, Times, Serif" size="3"> = 16.2. What is the value of </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">result</font><font face="Times New Roman, Times, Serif" size="3"> when each of the following calls returns?</font></td><td></td></tr><tr><td colspan="3"></td></tr><tr><td colspan="3" height="1"></td></tr></table><table border="0" cellspacing="0" cellpadding="0"><tr><td rowspan="5"><img src="3e26ecb1b6ac508ae10a0e39d2fb98b2.gif" border="0" width="24" height="1" alt="3e26ecb1b6ac508ae10a0e39d2fb98b2.gif" /></td>  <td colspan="3" height="12"></td>  <td rowspan="5"></td></tr><tr><td colspan="3"></td></tr><tr><td></td>  <td><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">float聽Test(聽float聽x,<br />聽聽聽聽聽聽聽聽聽聽聽聽float聽y,<br />聽聽聽聽聽聽聽聽聽聽聽聽float聽z聽)<br />{<br />聽聽聽聽if聽(x聽&gt;聽y聽||聽y聽&gt;聽z)<br />聽聽聽聽聽聽聽聽return聽0.5;<br />聽聽聽聽else<br />聽聽聽聽聽聽聽聽return聽-0.5;<br />}<br /><br />a.聽result聽=聽Test(5.2,聽5.3,聽5.6);<br />b.聽result聽=聽Test(fabs(a),聽b,聽c);</font></td><td></td></tr><tr><td colspan="3"></td></tr><tr><td colspan="3" height="1"></td></tr></table><table border="0" cellspacing="0" cellpadding="0"><tr><td rowspan="5"></td>  <td colspan="3" height="12"></td>  <td rowspan="5"></td></tr><tr><td colspan="3"></td></tr><tr><td></td>  <td><font face="Times New Roman, Times, Serif" size="3">10. What is wrong with each of the following C++ function definitions?</font></td><td></td></tr><tr><td colspan="3"></td></tr><tr><td colspan="3" height="1"></td></tr></table><table border="0" cellspacing="0" cellpadding="0"><tr><td rowspan="5"><img src="3e26ecb1b6ac508ae10a0e39d2fb98b2.gif" border="0" width="24" height="1" alt="3e26ecb1b6ac508ae10a0e39d2fb98b2.gif" /></td>  <td colspan="3" height="12"></td>  <td rowspan="5"></td></tr><tr><td colspan="3"></td></tr><tr><td></td>  <td><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">a.聽void聽Test1(聽int聽m,<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽int聽n聽)<br />聽聽聽{<br />聽聽聽聽聽聽return聽3聽*聽m聽+聽n;<br />聽聽聽}<br />b.聽float聽Test2(聽int聽聽聽i,<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽float聽x聽)<br />聽聽聽{<br />聽聽聽聽聽聽i聽=聽i聽+聽7;<br />聽聽聽聽聽聽x聽=聽4.8聽+聽float(i);<br />}</font></td><td></td></tr><tr><td colspan="3"></td></tr><tr><td colspan="3" height="1"></td></tr></table><table border="0" cellspacing="0" cellpadding="0"><tr><td rowspan="5"></td>  <td colspan="3" height="12"></td>  <td rowspan="5"></td></tr><tr><td colspan="3"></td></tr><tr><td></td>  <td><font face="Times New Roman, Times, Serif" size="3">11. Explain why it is risky to use a reference parameter as a formal parameter of a value-returning function.</font></td><td></td></tr><tr><td colspan="3"></td></tr><tr><td colspan="3" height="1"></td></tr></table></td></tr></table><p><font size="0"></font></p>  </td>			</tr>				<tr>				<td align="left" width="30%" style="background: #EEF3E2"><a style="color: blue; font-size: 120%; font-weight: bold; text-decoration: none; font-family: verdana;" href="page_453.html">&lt;&nbsp;previous page</a></td>				<td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_454</strong></td>				<td align="right" width="30%" style="background: #EEF3E2"><a style="color: blue; font-size: 120%; font-weight: bold; text-decoration: none; font-family: verdana;" href="page_455.html">next page&nbsp;&gt;</a></td>			</tr>		</table>		</body>	</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -