有一道c语言的题目,我实在想不出来,求大佬帮忙

2024-12-14 14:30:07
推荐回答(1个)
回答1:

#include

main()
{
    int temp,i,number;
    char str[200];

    do{
        for(temp=0;temp<200;temp++)
        {
            str[temp] = '\0';
        }
        scanf("%s",&str);

        if(str[0] != '#')
        {
            if(str[0] >= '0' && str[0] <= '9')
            {
                number = 0;
                i=0;

                do{
                    if(i!=0)
                    {
                        number *= 10;
                    }

                    number += str[i++] - '0';

                }while(str[i] >= '0' && str[i] <= '9');

                if(str[i] >= 'A' && str[i] <= 'z')
                {
                    for(temp=0;temp                    {
                        printf("%c",str[i]);
                    }
                    printf("\n");
                }
                else
                {
                    printf("%s\n",str);
                }

            }
            else
            {
                printf("%s\n",str);
            }

        }
    }while(str[0] != '#');

    return 0;
}