c语言中 ,编写函数统计输入字符的个数,用@字符结束输入。在主函数中调用此函数,输出统计结果。

#include <stdio.h>

int fun()
{
    char a;
    int n = 0;

    a = getchar();
    while(a !='@' )
    {
        n++;
        a = getchar();
    }
    return n;
}
void main()
{
    int x;
    x = fun();
    printf("%d",x);

猜你喜欢

转载自blog.csdn.net/liuyang___/article/details/121684430