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

📄 page_116.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_116</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_115.html">&lt;&nbsp;previous page</a></td>				<td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_116</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_117.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 116</font></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">Let's treat all of the quantities as named constants so that it is easier to change the program later. From measuring the map, you know that the distance from the museum to the record store is 1.5 inches, from the record store to the gallery is 2.3 inches, from the gallery to the bookshop is 5.9 inches, and from the bookshop to the concert is 4.0 inches. Here is the algorithmic solution:</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="Courier New, Courier, Mono New, Courier, Mono" size="2">DISTANCE1聽=聽1.5<br />DISTANCE2聽=聽2.3<br />DISTANCE3聽=聽5.9<br />DISTANCE4聽=聽4.0<br />SCALE聽=聽0.25<br />Set聽totMiles聽=聽0.0<br />Set聽miles聽=聽float(int(DISTANCE1聽</font><font face="Symbol" size="2">*</font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">聽SCALE聽</font><font face="Symbol" size="2">*</font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">聽10.0聽+聽0.5))聽/聽10.0<br />Print聽DISTANCE1,聽miles<br />Add聽miles聽to聽totMiles<br />Set聽miles聽=聽float(int(DISTANCE2聽</font><font face="Symbol" size="2">*</font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">聽SCALE聽</font><font face="Symbol" size="2">*</font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">聽10.0聽+聽0.5))聽/聽10.0<br />Print聽DISTANCE2,聽miles<br />Add聽miles聽to聽totMiles<br />Set聽miles聽=聽float(int(DISTANCE3聽</font><font face="Symbol" size="2">*</font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">聽SCALE聽</font><font face="Symbol" size="2">*</font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">聽10.0聽+聽0.5))聽/聽10.0<br />Print聽DISTANCE3,聽miles<br />Add聽miles聽to聽totMiles<br />Set聽miles聽=聽float(int(DISTANCE4聽</font><font face="Symbol" size="2">*</font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">聽SCALE聽</font><font face="Symbol" size="2">*</font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">聽10.0聽+聽0.5))聽/聽10.0<br />Print聽DISTANCE4,聽miles<br />Add聽miles聽to聽totMiles<br />Print聽a聽blank聽line<br />Print聽totMiles</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">From the algorithm we can create tables of constants and variables that help us write the declarations in the program.</font></td><td></td></tr><tr><td colspan="3"></td></tr><tr><td colspan="3" height="1"></td></tr></table><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td height="12"></td></tr><tr><td><table cellspacing="0" width="384" cellpadding="7"><tr><td colspan="3" valign="top"><font face="Times New Roman, Times, Serif" size="2"><i>Constants</i></font></td></tr><tr><td valign="top"><font face="Times New Roman, Times, Serif" size="2"><i>Name</i></font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2"><i>Value</i></font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2"><i>Description</i></font></td></tr><tr><td valign="top"><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">DISTANCE1</font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2">1.5</font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2">Measurement for first distance</font></td></tr><tr><td valign="top"><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">DISTANCE2</font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2">2.3</font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2">Measurement for second distance</font></td></tr><tr><td valign="top"><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">DISTANCE3</font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2">5.9</font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2">Measurement for third distance</font></td></tr><tr><td valign="top"><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">DISTANCE4</font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2">4.0</font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2">Measurement for fourth distance</font></td></tr><tr><td valign="top"><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">SCALE</font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2">0.25</font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2">Scale factor of map</font></td></tr></table></td></tr></table><br /></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_115.html">&lt;&nbsp;previous page</a></td>				<td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_116</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_117.html">next page&nbsp;&gt;</a></td>			</tr>		</table>		</body>	</html>

⌨️ 快捷键说明

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