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

📄 page_829.html

📁 Programming and Problem Solving with C++
💻 HTML
📖 第 1 页 / 共 2 页
字号:
  <td><font face="Times New Roman, Times, Serif" size="3">Each </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">struct</font><font face="Times New Roman, Times, Serif" size="3"> and enumeration type should have a separate type declaration.</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">4. a. Declare a </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">struct</font><font face="Times New Roman, Times, Serif" size="3"> type named </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">AptType</font><font face="Times New Roman, Times, Serif" size="3"> for an apartment locator service. The following information should be included:</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="58" 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="Times New Roman, Times, Serif" size="3">Landlord (a string of up to 20 characters)<br />Address (a string of up to 20 characters)<br />Bedrooms (integer)<br />Price (floating point)</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="29" 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="Times New Roman, Times, Serif" size="3">b. Declare </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">available</font><font face="Times New Roman, Times, Serif" size="3"> to be an array of up to 200 </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">structs</font><font face="Times New Roman, Times, Serif" size="3"> of type </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">AptType</font><font face="Times New Roman, Times, Serif" size="3">.</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="29" 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="Times New Roman, Times, Serif" size="3">c. Write a function to read values into the members of a variable of type </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">AptType</font><font face="Times New Roman, Times, Serif" size="3">. (The </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">struct</font><font face="Times New Roman, Times, Serif" size="3"> variable should be passed as a parameter.) The order in which the data is read is the same as that of the items in the </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">struct</font><font face="Times New Roman, Times, Serif" size="3">.</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">5. Using the declarations given in Exam Preparation Exercise 2, write statements to do the following:</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="29" 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="Times New Roman, Times, Serif" size="3">a. Assign the contents of the </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">chart</font><font face="Times New Roman, Times, Serif" size="3"> member of </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">aMap</font><font face="Times New Roman, Times, Serif" size="3"> to </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">aRef</font><font face="Times New Roman, Times, Serif" size="3">.</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="29" 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="Times New Roman, Times, Serif" size="3">b. Assign </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">aMap</font><font face="Times New Roman, Times, Serif" size="3"> to the fourth element of </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">guide</font><font face="Times New Roman, Times, Serif" size="3">.</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="29" 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="Times New Roman, Times, Serif" size="3">c. Copy </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">aCode</font><font face="Times New Roman, Times, Serif" size="3"> to the </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">mapCode</font><font face="Times New Roman, Times, Serif" size="3"> member of the tenth element of </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">guide</font><font face="Times New Roman, Times, Serif" size="3">.</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="29" 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="Times New Roman, Times, Serif" size="3">d. Compare the first character in </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">aCode</font><font face="Times New Roman, Times, Serif" size="3"> and the first character in the </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">mapCode</font><font face="Times New Roman, Times, Serif" size="3"> member of the second element of </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">guide</font><font face="Times New Roman, Times, Serif" size="3">. If they are equal, then output the </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">mapCode</font><font face="Times New Roman, Times, Serif" size="3"> member and the </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">style</font><font face="Times New Roman, Times, Serif" size="3"> member of the second element of </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">guide</font><font face="Times New Roman, Times, Serif" size="3">.</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_828.html">&lt;&nbsp;previous page</a></td>				<td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_829</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_830.html">next page&nbsp;&gt;</a></td>			</tr>		</table>		</body>	</html>

⌨️ 快捷键说明

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