回复 2楼 李少iii
#include <stdio.h>
#include <math.h>
#define LOW 10
int main(void)
{
int first,does,i,da;
int sum=0,change=0;
//int *arr;
printf ("请输入你要进行操作的初始数\n");
scanf ("%d",&first);
//判断位数
does=first;
while (first)
{
first/=10;
sum++;
}
first=does;//将first重置为初始值
printf ("%d是个%d位数\n",first,sum);
//颠倒位置
int arr[sum];
da=sum;
for ( i=0;i<sum;i++)
{ *(arr+i)=does%10;
does=(does-arr)/10;
change+=(pow(LOW,--da))*arr;
}
printf("%d所求倒序数为%d,反向数为%d\n",first,change,change+first);
return 0;
}
Compiling...
1.c
C:\Windows\System32\1.c(24) : error C2143: syntax error : missing ';' before 'type'
C:\Windows\System32\1.c(28) : error C2065: 'arr' : undeclared identifier
C:\Windows\System32\1.c(28) : error C2100: illegal indirection
C:\Windows\System32\1.c(28) : error C2106: '=' : left operand must be l-value
C:\Windows\System32\1.c(30) : warning C4244: '+=' : conversion from 'double ' to 'int ', possible loss of data
Error executing cl.exe.
1.obj - 4 error(s), 1 warning(s)
为啥出来有错误类