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

📄 page_69.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_69</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_68.html">&lt;&nbsp;previous page</a></td>				<td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_69</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_70.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 69</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"><i>from</i> the expression or string written on the right <i>to</i> the output stream on the left.</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">You can use the &lt; operator several times in a single output statement. Each occurrence appends the next data item to the output stream. For example, we can write the preceding two output statements as</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">cout聽&lt;聽The聽answer聽is聽聽&lt;聽3聽*聽num;</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">If </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">num</font><font face="Times New Roman, Times, Serif" size="3"> contains the value 5, both versions produce the same output:</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">The聽answer聽is聽15</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">The output statement has the following form, where ExprOrString stands for either an expression of simple type or a string constant:</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"><img src="604153d5e6462a1560939ac69aea244a.gif" border="0" alt="0069-01.gif" width="342" height="87" /></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">The following output statements yield the output shown. These examples assume that the variable </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">i</font><font face="Times New Roman, Times, Serif" size="3"> contains the value 2, and </font><font face="Courier New, Courier, Mono New, Courier, Mono" size="3">j</font><font face="Times New Roman, Times, Serif" size="3"> contains 6.</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="499" cellpadding="7"><tr><td valign="top"><font face="Times New Roman, Times, Serif" size="2"><i>Statement</i></font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2"><i>What Is Printed (<img src="991f4a033b73bdeac7864e4a633e8ee3.gif" border="0" alt="box.gif" width="14" height="19" />; means blank)</i></font></td></tr><tr><td valign="top"><font face="Times New Roman, Times, Serif" size="2"></font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">cout聽&lt;聽i;</font><font face="Times New Roman, Times, Serif" size="2"></font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2"></font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">2</font><font face="Times New Roman, Times, Serif" size="2"></font></td></tr><tr><td valign="top"><font face="Times New Roman, Times, Serif" size="2"></font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">cout聽&lt;聽i聽=聽聽&lt;聽i</font><font face="Times New Roman, Times, Serif" size="2"> ;</font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2"></font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">i聽<img src="991f4a033b73bdeac7864e4a633e8ee3.gif" border="0" alt="box.gif" width="14" height="19" />;聽=聽<img src="991f4a033b73bdeac7864e4a633e8ee3.gif" border="0" alt="box.gif" width="14" height="19" />;聽2</font><font face="Times New Roman, Times, Serif" size="2"></font></td></tr><tr><td valign="top"><font face="Times New Roman, Times, Serif" size="2"></font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">cout聽&lt;聽Sum聽=聽聽聽&lt;聽i聽聽+聽聽j;</font><font face="Times New Roman, Times, Serif" size="2"></font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2"></font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">Sum聽<img src="991f4a033b73bdeac7864e4a633e8ee3.gif" border="0" alt="box.gif" width="14" height="19" />;聽=聽<img src="991f4a033b73bdeac7864e4a633e8ee3.gif" border="0" alt="box.gif" width="14" height="19" />;聽8</font><font face="Times New Roman, Times, Serif" size="2"></font></td></tr><tr><td valign="top"><font face="Times New Roman, Times, Serif" size="2"></font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">cout聽&lt;聽ERROR聽MESSAGE;</font><font face="Times New Roman, Times, Serif" size="2"></font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2"></font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">ERROR聽<img src="991f4a033b73bdeac7864e4a633e8ee3.gif" border="0" alt="box.gif" width="14" height="19" />;聽MESSAGE</font><font face="Times New Roman, Times, Serif" size="2"></font></td></tr><tr><td valign="top"><font face="Times New Roman, Times, Serif" size="2"></font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">cout聽&lt;聽Error=聽&lt;聽聽i;</font><font face="Times New Roman, Times, Serif" size="2"></font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2"></font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">Error=2</font><font face="Times New Roman, Times, Serif" size="2"></font></td></tr><tr><td valign="top"><font face="Times New Roman, Times, Serif" size="2"></font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">cout聽&lt;聽j:聽&lt;聽j聽&lt;聽i:聽&lt;聽i;</font><font face="Times New Roman, Times, Serif" size="2"></font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2"></font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">j聽:聽6i聽:聽2</font><font face="Times New Roman, Times, Serif" size="2"></font></td></tr><tr><td valign="top"><font face="Times New Roman, Times, Serif" size="2"></font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">cout聽&lt;聽j:聽&lt;聽j聽&lt;聽聽聽&lt;聽i:聽&lt;聽i;</font><font face="Times New Roman, Times, Serif" size="2"></font></td><td valign="top"><font face="Times New Roman, Times, Serif" size="2"></font><font face="Courier New, Courier, Mono New, Courier, Mono" size="2">j聽:聽6<img src="991f4a033b73bdeac7864e4a633e8ee3.gif" border="0" alt="box.gif" width="14" height="19" />;i聽:聽2</font><font face="Times New Roman, Times, Serif" size="2"></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">An output statement prints string constants exactly as they appear within quotes. To let the computer know that you want to print a string constantnot a named constant or variableyou must use double quotes to enclose the string. If you don't put quotes around a string, you'll probably get an error message (like UNDECLARED IDENTIFIER) from the C++ compiler. If you want to print a string that includes a double quote, you must type a backslash (\) character and a double quote, with no space between them, in the string. For example, to print the string</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_68.html">&lt;&nbsp;previous page</a></td>				<td align="center" width="40%" style="background: #EEF3E2"><strong style="color: #2F4F4F; font-size: 120%;">page_69</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_70.html">next page&nbsp;&gt;</a></td>			</tr>		</table>		</body>	</html>

⌨️ 快捷键说明

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