zoukankan      html  css  js  c++  java
  • while循环

    Action()
    {
    
    	int i;
    	int done = 1;
    	char a[6],b[5],c[5],d[6];
    
    
    
    
    	/***********for循环******************************************************/
        for (i=1;i<=10;i++)
    	{
            lr_output_message( "for循环次数: %d", i);
    	}
    
    
    
    	/***********while循环*****************************************************/
    	/*为了实现上面for循环相同效果,这里略复杂点,用到了 && 运算*/
    
    	i = 1;
    	while ((i<=10)&&(done ==1)) {
            lr_output_message( "while for循环次数:%d", i);
    		i++;
    	}
    
    
    
    	/***********do while循环***************************************************/
    	/*为了实现上面for循环相同效果,这里略复杂点,用到了 && 运算*/
    
    	i = 1;
    	do{
            lr_output_message( "do while循环次数:%d", i);
    		i++;
    	}
    	while (	i <= 10);{
    
    	}
    
    
    	/***********while循环*****************************************************/
    	/*为了实现while循环赋值,这里上面需要定义char a[6],b[5],c[5],d[6];*/
    
    	i = 0;
    	while (i<5) {
    		a[i]=97+i;
    		i++;
    	}
    
    	a[5]= 0;
    	lr_output_message("a=%s",a);
    
    	/***********do while循环***************************************************/
    	i = 0;
    	do{
    		b[i]=97+i;
    		i++;
    	}
    
    	while (i<5); {
    	b[5]=0;
    	lr_output_message("b=%s",b);
    	}
    
    
    
    	return 0;
    }
    

      

  • 相关阅读:
    硬件基础---拆装机
    Dynamics CRM 2015 Update 1 系列(4): 自己定义主键
    Heroku第三方服务接入指南(二)
    ssh 免密登录
    CentOS 7 NAT软路由
    Nginx升级
    挖矿病毒
    安装 epel-release
    hydra 安装和使用
    Linux 安全信息查看
  • 原文地址:https://www.cnblogs.com/zhenning17/p/15201591.html
Copyright © 2011-2022 走看看