| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 567 人关注过本帖
标题:谁来帮我吧FOR改成while
取消只看楼主 加入收藏
hedy704
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2010-7-23
结帖率:100%
收藏
 问题点数:0 回复次数:1 
谁来帮我吧FOR改成while
程序代码:
for(i=0;(c=str[i])!='\0';i++)
        if(c==' ')word=0;
        else if(word==0)
        {
            word=1;
            num++;
        }
        printf("There are %d words in the line.\n",num);
谁来帮我吧FOR改成while
搜索更多相关主题的帖子: FOR 
2010-07-25 14:41
hedy704
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2010-7-23
收藏
得分:0 
i=0;
while((c=str[i])!='\0')
{      
        if(c==' ')word=0;
        else if(word==0)
        {
            word=1;
            num++;
        }
       i++;
}
printf("There are %d words in the line.\n",num);
这样行不?
2010-07-25 15:05
快速回复:谁来帮我吧FOR改成while
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016355 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved