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

📄 page_a59.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_a59</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_a58.html">&lt;&nbsp;previous page</a></td>				<td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_a59</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_a60.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 A59</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">{<br />聽聽聽聽return聽sqrt(side1*side1聽+聽side2*side2);<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">13. Below, the type of </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">costPerOunce</font><font face="Times New Roman, Times, Serif" size="3"> and the function return type are </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">float</font><font face="Times New Roman, Times, Serif" size="3"> so that cost can be expressed in terms of dollars and cents (e.g., 1.23 means $1.23).</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">These types could be integer if cost is expressed in terms of cents only (e.g., 123 means $1.23).</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聽Postage(聽/*聽in聽*/聽int聽聽聽pounds,<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽/*聽in聽*/聽int聽聽聽ounces,<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽/*聽in聽*/聽float聽costPerOunce聽)<br /><br />//聽Precondition:<br />//聽聽聽聽聽pounds聽&gt;=聽0聽&amp;&amp;聽ounces聽&gt;=聽0聽&amp;&amp;聽costPerOunce聽&gt;=聽0.0<br />//聽Postcondition:<br />//聽聽聽聽聽Function聽value聽==聽(pounds聽*聽16聽+聽ounces)聽*聽costPerOunce<br /><br />{<br />聽聽聽聽return聽(pounds聽*聽16聽+聽ounces)聽*聽costPerOunce;<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="17"></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">Chapter 8<br />Case Study Follow-Up</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">3. Change the body of </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">GetData</font><font face="Times New Roman, Times, Serif" size="3"> so that it begins as follows:</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">{<br />聽聽聽聽Boolean聽badData;聽聽聽//聽True聽if聽an聽input聽value聽is聽invalid<br /><br />聽聽聽聽badData聽=聽TRUE;<br />聽聽聽聽while聽(badData)<br />聽聽聽聽{<br />聽聽聽聽聽聽聽聽cout聽&lt;&lt;聽Enter聽the聽number聽of聽crew聽(1聽or聽2).聽&lt;&lt;聽endl;<br />聽聽聽聽聽聽聽聽cin聽&gt;&gt;聽crew;<br />聽聽聽聽聽聽聽聽badData聽=聽(crew聽&lt;CH:160&gt;1聽||聽crew聽&gt;聽2);<br />聽聽聽聽聽聽聽聽if聽(badData)<br />聽聽聽聽聽聽聽聽聽聽聽聽cout聽&lt;&lt;聽Invalid聽number聽of聽crew聽members.聽&lt;&lt;聽endl;<br />聽聽聽聽}<br /><br />聽聽聽聽badData聽=聽TRUE;<br />聽聽聽聽while聽(badData)<br />聽聽聽聽{<br />聽聽聽聽聽聽聽聽cout聽&lt;&lt;聽Enter聽the聽number聽of聽passengers聽(0聽through聽8).<br />聽聽聽聽聽聽聽聽聽聽聽聽聽&lt;&lt;聽endl;<br />聽聽聽聽聽聽聽聽cin聽&gt;&gt;聽passengers;<br />聽聽聽聽聽聽聽聽badData聽=聽(passengers聽&lt;CH:160&gt;0聽||聽passengers聽&gt;聽8);<br />聽聽聽聽聽聽聽聽if聽(badData)<br />聽聽聽聽聽聽聽聽聽聽聽聽cout聽&lt;&lt;聽Invalid聽number聽of聽passengers.聽&lt;&lt;聽endl;<br />聽聽聽聽}</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_a58.html">&lt;&nbsp;previous page</a></td>				<td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_a59</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_a60.html">next page&nbsp;&gt;</a></td>			</tr>		</table>		</body>	</html>

⌨️ 快捷键说明

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