以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 C/C++编程思想 』  (http://bbs.xml.org.cn/list.asp?boardid=61)
----  [求助]请问这两个程序结果是一样的吗??  (http://bbs.xml.org.cn/dispbbs.asp?boardid=61&rootid=&id=63001)


--  作者:theme
--  发布时间:5/23/2008 3:36:00 PM

--  [求助]请问这两个程序结果是一样的吗??
#include<iostream.h>
main()
{
   int i,s;
   for(i=1;i<10;i++)
   {
     s=0;
     s=s+1;
     if(s>8)
     break;
   }
   cout<<s;
}


#include<iostream.h>
main()
{
    int i;
    static int s;
    for (i=1;i<10;i++)
 {
       s=0;
       s=s+1;
       if(s>8)
       break;
 }
    cout<<s;

}


其中break语句是跳出语句吗??


--  作者:BirdOnSky
--  发布时间:5/23/2008 9:00:00 PM

--  
s==1

s==1


--  作者:yarakchou
--  发布时间:5/24/2008 11:57:00 PM

--  
一样
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
9,110.840ms