example2-10.htm

来自「Visual C++面向对象程序设计教程(配套习题资源)」· HTM 代码 · 共 30 行

HTM
30
字号
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>例2-10</title>
</head>

<body>

<p style="line-height: 150%"><font size="2">#include  &lt;iostream.h><br> 
void main( )<br> 
{<br>
  int num, sum=0;<br> 
  cout&lt;&lt;"please input number:";<br> 
  for (int i=1;i&lt;=10;i++)<br> 
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; cin&gt;&gt;num;<br>
&nbsp;&nbsp;&nbsp; if(num&lt;0)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; continue;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sum+=num;<br>
&nbsp;&nbsp;&nbsp; }<br>
  cout &lt;&lt;"sum="&lt;&lt;sum&lt;&lt;endl;<br> 
}</font></p>

</body>

</html>

⌨️ 快捷键说明

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