c语言编程题?

2024-11-26 09:56:37
推荐回答(1个)
回答1:

#include 


int main()

{

    char c;

    int cnt=0;

    printf("请输入一行字符(回车结束):\n");

    while((c=getchar())!='\n')

    {

        if(c>='a'&&c<='z'||c>='A'&&c<='Z'||c>='0'&&c<='9')

            cnt++;

        else

            break;

    }

    printf("%s法用户名!\n",c=='\n'&&cnt>=6&&cnt<=16?"合":"非");

    return 0;

}