• 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;
    }
    

      

  • 相关阅读:
    python day04 列表增删改查
    python day03 字符串操作
    python day02 格式化输出逻辑运算
    面试题
    python基础练习题(一)
    编译安装PostgreSQL
    Python函数初识二
    Python函数初识
    笨办法学Python
    笨办法学Python
  • 原文地址:https://www.cnblogs.com/zhenning17/p/15201591.html
Copyright © 2020-2023  润新知