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