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

📄 page_808.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_808</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_807.html">&lt;&nbsp;previous page</a></td>				<td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_808</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_809.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 808</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="Courier New, Courier, Mono New, Courier, Mono" size="2">//聽Precondition:<br />//聽聽聽聽聽length聽&lt;=聽MAX_FRIENDS<br />//聽聽&amp;&amp;聽addressBook[0..length-1]聽are聽assigned<br />//聽Postcondition:<br />//聽聽聽聽聽Contents聽of聽addressBook[0..length-1]聽have聽been聽output<br />//聽聽聽聽聽to聽friendFile<br /><br />{<br />聽聽聽聽int聽counter;聽聽聽聽聽聽聽聽//聽Loop聽counter<br /><br />聽聽聽聽for聽(counter聽=聽0;聽counter聽&lt;聽length;聽counter++)<br />聽聽聽聽{<br />聽聽聽聽聽聽聽聽聽聽聽聽//聽Invariant聽(prior聽to聽test):<br />聽聽聽聽聽聽聽聽聽聽聽聽//聽聽聽聽聽Contents聽of聽addressBook[0..counter-1]聽have<br />聽聽聽聽聽聽聽聽聽聽聽聽//聽聽聽聽聽been聽output<br />聽聽聽聽聽聽聽聽聽聽聽聽//聽聽&amp;&amp;聽0聽&lt;=聽counter聽&lt;=聽length<br /><br />聽聽聽聽聽聽聽聽friendFile聽&lt;&lt;聽addressBook[counter].firstName聽&lt;&lt;聽聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽&lt;&lt;聽addressBook[counter].lastName聽&lt;&lt;聽endl;<br />聽聽聽聽聽聽聽聽friendFile聽&lt;&lt;聽(聽&lt;&lt;聽addressBook[counter].areaCode聽&lt;&lt;聽)聽<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽&lt;&lt;聽addressBook[counter].phoneNumber聽&lt;&lt;聽endl;<br />聽聽聽聽聽聽聽聽friendFile聽&lt;&lt;聽setw(2)聽&lt;&lt;聽addressBook[counter].month聽&lt;&lt;聽/<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽&lt;&lt;聽setw(2)聽&lt;&lt;聽addressBook[counter].day聽&lt;&lt;聽/<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽&lt;&lt;聽setw(4)聽&lt;聽addressBook[counter].year聽&lt;&lt;聽endl;<br />聽聽聽聽聽聽聽聽friendFile聽&lt;&lt;聽endl;<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">Testing: This is an interactive program in which the user has a great deal of control. The user is prompted to enter data, then is asked if the data have been entered correctly. If the user indicates that there has been an error, the data are not saved. After the information about a person is entered, the user is asked whether he or she wishes to continue.</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">In testing this program, each of the two options must be selected by the user at least once. When testing an interactive program, you may be tempted to sit down and just enter data randomly. However, if you don't keep a record of the data entered, the saved file will show only the correct entries. You won't know whether or not the sections of code that allow the program to ignore an incorrect entry were tested.</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">Another thing to be tested is the alternate way in which the main reading loop can terminate: the address book becomes full. As </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">MAX_FRIENDS</font><font face="Times New Roman, Times, Serif" size="3"> is defined to be 150, you don't want to sit at the keyboard and type 150 entries to watch it become full! What you can do is comment out  the const declaration by preceding it with </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">//</font><font face="Times New Roman, Times, Serif" size="3">. Then insert a new declaration defining</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_807.html">&lt;&nbsp;previous page</a></td>				<td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_808</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_809.html">next page&nbsp;&gt;</a></td>			</tr>		</table>		</body>	</html>

⌨️ 快捷键说明

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