C语言编程问题:文件批量改名

2025-04-03 17:30:15
推荐回答(1个)
回答1:

#include
#include
int main()
{
    char s[10000];
    int i,m,n;
    while(~scanf("%d,%d",&m,&n))
    {
        scanf("%s",s);
        int d=strlen(s),dian=0,p=0;
        for(i=0; i        {
            if(s[i]=='.')
            {
                dian=i;
                break;
            }
        }
        int tep=n;
        while(tep)
        {
            tep/=10;
            p++;
        }
        for(int ans=m; ans<=n; ans++)
        {

            for(i=0; i                printf("%c",s[i]);
            printf("%0*d",p,ans);
            for(i=dian; i                printf("%c",s[i]);
            puts("");
        }
    }
    return 0;
}