我想用两个while把文中这条语句输出,是来嗯个while哦
本帖最后由 奥普瓯江 于 2017-11-28 13:37 编辑#include<stdio.h>
int main(void)
{
char *a1 = "hello";
char *a2 = "yes konw";
char *a3 = "name";
char *a4 = "nihao";
char *number;
number = a1;
number = a2;
number = a3;
number = a4;
char *may;
for (int i = 0; i < 4; i++)
{
may = number;
while (*may != '\0' )
{
printf("%c\n", *may++);
}
putchar('\n');
}
return 0;
}
这是现在这个程序运行的结果 #include<stdio.h>
int main(void)
{
char *a1 = "hello";
char *a2 = "yes konw";
char *a3 = "name";
char *a4 = "nihao";
char *number;
number = a1;
number = a2;
number = a3;
number = a4;
char *may;
int i = 0;
while(true)
{
may = number;
while (*may != '\0' )
{
printf("%c\n", *may++);
}
putchar('\n');
i++;
if (i >= 4)
{
break;
}
}
return 0;
}
把for循环改了就行了
int i = 0;
while (i < 4)
{
may = number;
while (*may != '\0' )
{
printf("%c\n", *may++);
}
putchar('\n');
i++;
} int man(void)和int main的区别是啥 {:10_250:} #include<stdio.h>
int main(void)
{int i = 0;
char *a1 = "hello";
char *a2 = "yes konw";
char *a3 = "name";
char *a4 = "nihao";
char *number;
number = a1;
number = a2;
number = a3;
number = a4;
char *may;
while (i<4)
{
may = number;
while (*may != '\0' )
{
printf("%c", *may++);
}
putchar('\n');
i++;
}
return 0;
}
页:
[1]