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

📄 page_584.html

📁 Programming and Problem Solving with C++
💻 HTML
📖 第 1 页 / 共 2 页
字号:
</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">11. In arithmetic and relational expressions, which of the following could occur:</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">type promotion, type demotion, or both? (pp. 547551)f:</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">Answers 1. The integral types are </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">char</font><font face="Times New Roman, Times, Serif" size="3">, </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">short,聽int,聽long</font><font face="Times New Roman, Times, Serif" size="3">, and </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">enum</font><font face="Times New Roman, Times, Serif" size="3">. The floating point types are </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">float,聽double,</font><font face="Times New Roman, Times, Serif" size="3"> and </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">long聽double</font><font face="Times New Roman, Times, Serif" size="3">. 2. An expression becomes an expression statement when it is terminated by a semicolon. 3. The external representation is the letter <i>X;</i> the internal representation is the integer 88. 4. Because representational errors can cause the loop termination condition to be evaluated with unpredictable results. 5. 400500.000 (Actually, 4.005E+5)</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">6. Floating point arithmetic is subject to numerical inaccuracies and is slower than integer arithmetic on most machines. Use of the smaller integral types, </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">char</font><font face="Times New Roman, Times, Serif" size="3"> and </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">short</font><font face="Times New Roman, Times, Serif" size="3">, can more easily lead to overflow errors. The </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">long</font><font face="Times New Roman, Times, Serif" size="3"> type usually requires more memory than </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">int</font><font face="Times New Roman, Times, Serif" size="3">, and the arithmetic is usually slower.</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">7.聽enum聽AutoMakes聽{SAAB,聽JAGUAR,聽CITROEN,聽CHEVROLET,聽FORD};<br />8.聽for聽(rainbow聽=聽RED;聽rainbow聽</font><font face="Symbol" size="2"></font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">聽VIOLET;聽rainbow聽=聽VisibleColors聽(rainbow聽+1))</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">9. Named types make a program more readable, more understandable, and easier to modify. Also, a variable of an anonymous enumeration type cannot be assigned to a variable of a named enumeration type, even if the domains of the types are the same. 10. </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">#include聽calendar.h</font><font face="Times New Roman, Times, Serif" size="3"> 11. Type promotion</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"><i>Exam Preparation Exercises</i></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">1. Every C++ compiler guarantees that </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">sizeof(int)聽&lt;聽sizeof(long)</font><font face="Times New Roman, Times, Serif" size="3">. (True or False?)</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">2. Classify each of the following as either an expression or an expression statement.</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">a.聽sum聽=聽0<br />b.聽sqrt(x)<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_583.html">&lt;&nbsp;previous page</a></td>				<td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_584</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_585.html">next page&nbsp;&gt;</a></td>			</tr>		</table>		</body>	</html>

⌨️ 快捷键说明

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