#include<stdio.h>void main(){ int n = 0; printf("input a string:\n");loop:if(getchar() != '\n') { n++ ; goto loop; //跳转到标号loop处 } printf("The number of character is:%d",n);}
3 回答
望远
TA贡献1017条经验 获得超1032个赞
int count=0,flag=1; char c; while(flag) { switch(c=getchar()) { case '\n':flag=0;break; default:count++; } } printf("count=%d\n",count);
- 3 回答
- 0 关注
- 1488 浏览
添加回答
举报
0/150
提交
取消