Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
147031 王晏林 回文数 C++ Compile Error 0 MS 0 KB 436 2026-02-02 14:41:48

Tests(0/0):


Code:

intx,y; separate(int*data,intn) { inti,j; y=0; while(n!=0) { *(data+y)=n%10;n=n/10;y++; } *(data+y)='\0'; for(i=0,j=y-1;i<=j;i++,j--) { if(*(data+i)!=*(data+j)){ printf("%d不是回文!!!\n",x);break; } } if(i ==y-1) printf("是回文数"); } voidmain() { inta[99]; printf("请输入一个正整数:"); scanf("%d",&x); separate(a,x); }


Run Info:

Main.cc:1:1: error: 'intx' does not name a type
 intx,y;
 ^
Main.cc:2:19: error: 'intn' has not been declared
 separate(int*data,intn)
                   ^
Main.cc:2:23: error: ISO C++ forbids declaration of 'separate' with no type [-fpermissive]
 separate(int*data,intn)
                       ^
Main.cc: In function 'int separate(int*, int)':
Main.cc:4:5: error: 'inti' was not declared in this scope
     inti,j;
     ^
Main.cc:4:10: error: 'j' was not declared in this scope
     inti,j;
          ^
Main.cc:5:5: error: 'y' was not declared in this scope
     y=0;
     ^
Main.cc:6:11: error: 'n' was not declared in this scope
     while(n!=0)
           ^
Main.cc:11:9: error: 'i' was not declared in this scope
     for(i=0,j=y-1;i<=j;i++,j--)
         ^
Main.cc:14:38: error: 'x' was not declared in this scope
         printf("%d不是回文!!!\n",x);break;
                                      ^
Main.cc:14:39: error: 'printf' was not declared in this scope
         printf("%d不是回文!!!\n",x);break;
                                       ^
Main.cc:17:8: error: 'i' was not declared in this scope
     if(i ==y-1) printf("是回文数");
        ^
Main.cc:17:38: error: 'printf' was not declared in this scope
     if(i ==y-1) printf("是回文数");
                                      ^
Main.cc:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
Main.cc: At global scope:
Main.cc:19:10: error: ISO C++ forbids declaration of 'voidmain' with no type [-fpermissive]
 voidmain()
          ^
Main.cc: In function 'int voidmain()':
Main.cc:21:1: error: 'inta' was not declared in this scope
 inta[99];
 ^
Main.cc:22:37: error: 'printf' was not declared in this scope
 printf("请输入一个正整数:");
                                     ^
Main.cc:23:13: error: 'x' was not declared in this scope
 scanf("%d",&x);
             ^
Main.cc:23:14: error: 'scanf' was not declared in this scope
 scanf("%d",&x);
              ^
Main.cc:24:10: error: 'a' was not declared in this scope
 separate(a,x);
          ^
Main.cc:25:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^