1.while循环,以及break, contine
#include<stdio.h>
int main()
{
int i = 1;
while (i <= 10)
{
if (i == 5)
{
break; //在while循环中,break用于永久的终止循环
//continue;//在while循环中,continue的作用是跳过本次循环continue后边的代码
}
printf("%d\n",i);
i++;
}
return 0;
}
2.getchar putchar
#include<stdio.h>
int main()
{
int ch = 0;
//ctrl+z - getchar就读取结束
while ((ch = getchar()) != EOF)
{
putchar(ch);
}
return 0;
}