📄 page_117.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>page_117</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_116.html">< previous page</a></td> <td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_117</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_118.html">next page ></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 117</font></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>Variables</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>Data Type</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">totMiles</font></td><td valign="top"><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">float</font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2">Total of rounded mileages</font></td></tr><tr><td valign="top"><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">miles</font></td><td valign="top"><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">float</font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2">An individual rounded mileage</font></td></tr></table></td></tr></table><br /><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">Now we're ready to write the program. Let's call it Walk. We take the declarations from the tables and the executable statements from the algorithm. We have labeled the output with explanatory messages and formatted it with fieldwidth specifications. We've also added comments where needed.</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">Here is the program:</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">//*****************************************************************<br />//聽Walk聽program<br />//聽This聽program聽computes聽the聽mileage聽(rounded聽to聽tenths聽of聽a聽mile)<br />//聽for聽each聽of聽four聽distances聽between聽points聽in聽a聽city,聽given<br />//聽the聽measurements聽on聽a聽map聽with聽a聽scale聽of聽one聽inch聽equal聽to<br />//聽one聽quarter聽of聽a聽mile<br />//*****************************************************************<br />#include聽<iostream.h><br />#include聽<iomanip.h>聽聽//聽For聽setprecision()<br /><br />const聽float聽DISTANCE1聽=聽1.5;聽聽聽聽//聽Measurement聽for聽first聽distance<br />const聽float聽DISTANCE2聽=聽2.3;聽聽聽聽//聽Measurement聽for聽second聽distance<br />const聽float聽DISTANCE3聽=聽5.9;聽聽聽聽//聽Measurement聽for聽third聽distance<br />const聽float聽DISTANCE4聽=聽4.0;聽聽聽聽//聽Measurement聽for聽fourth聽distance<br />const聽float聽SCALE聽=聽0.25;聽聽聽聽聽聽聽//聽Map聽scale<br /><br />int聽main()<br />{<br />聽聽聽聽float聽totMiles;聽聽聽聽聽聽聽聽聽//聽Total聽of聽rounded聽mileages<br />聽聽聽聽float聽miles;聽聽聽聽聽聽聽聽聽聽聽聽//聽An聽individual聽rounded聽mileage<br /><br />聽聽聽聽cout.setf(ios::fixed,聽ios::floatfield);聽聽聽//聽Set聽up聽floating聽pt.<br />聽聽聽聽cout.setf(ios::showpoint);聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽//聽聽聽output聽format<br /><br />totMiles聽=聽0.0;<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_116.html">< previous page</a></td> <td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_117</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_118.html">next page ></a></td> </tr> </table> </body> </html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -