求指教!为啥这个程序vc可以输出结果在Dev-cpp运行到scanf那里就不走了

求指教!为什么这个程序vc可以输出结果在Dev-cpp运行到scanf那里就不走了
#include<stdio.h>
#include<math.h> 
int main()
{
unsigned int a=0;
printf("Enter a postive integer: ");
scanf("%d",&a);


int i=1,
j=1,
n=0,
sum=0,
c=a,
b=0;
do
{
n=pow(10,i);
b=(c%n)/(n/10);
c-=b*(n/10);
i++;
}
while(c!=0);

c=a;
do
{
n=pow(10,j);
b=(c%n)/(n/10);
c-=b*(n/10);
sum+=b*pow(10,i-2);
j++;
i--;
}
while(i>=0);
printf("The number %d reserved is %d rebmun ehT.",a,sum);
return 0;







}

编译器为vc++6。0
Dev-c++5.4.1
------解决方案--------------------
求指教!为啥这个程序vc可以输出结果在Dev-cpp运行到scanf那里就不走了
执行没问题啊
------解决方案--------------------
gcc下执行的确没问题求指教!为啥这个程序vc可以输出结果在Dev-cpp运行到scanf那里就不走了
我的C-Free执行的确出不来结果,我单步时发现n在i等于2时变成了99而不是100,不知道是不是编译器问题——求指教!为啥这个程序vc可以输出结果在Dev-cpp运行到scanf那里就不走了
楼主不妨单步一下VC6和dev试试,看看有什么不同
------解决方案--------------------
我觉得可能是unsigned int和%d不匹配造成的问题。楼主可以试试这两个改动:
1.
unsigned int a=0;
scanf("%u",&a);
2.
int a=0;
scanf("%d",&a);
一般情况下unsigned int和%d混用都问题不大,dev-cpp不知道有什么不一样。

顺便说一句,我刚入行的时候曾经这么干过:
short a;
scanf("%d", &a);
结果就把栈弄崩了,自己还不知道是怎么回事。从那以后就觉得scanf太危险了(其实该说指针太危险了)
------解决方案--------------------
pow
Calculates x raised to the power of y.

double pow( double x, double y );

Routine Required Header Compatibility 
pow <math.h> ANSI, Win 95, Win NT 


For additional compatibility information, see Compatibility in the Introduction.

Libraries

LIBC.LIB Single thread static library, retail version 
LIBCMT.LIB Multithread static library, retail version 
MSVCRT.LIB Import library for MSVCRT.DLL, retail version 


Return Value

pow returns the value of xy. No error message is printed on overflow or underflow. 

Values of x and y Return Value of pow  
x < > 0 and y = 0.0 1 
x = 0.0 and y = 0.0 1 
x = 0.0 and y < 0 INF 


Parameters

x

Base

y

Exponent

Remarks

The pow function computes x raised to the power of y. 

pow does not recognize integral floating-point values greater than 264, such as 1.0E100.

Example

/* POW.C
 *
 */

#include <math.h>
#include <stdio.h>

void main( void )
{
   double x = 2.0, y = 3.0, z;

   z = pow( x, y );
   printf( "%.1f to the power of %.1f is %.1f\n", x, y, z );
}


Output

2.0 to the power of 3.0 is 8.0


Floating-Point Support Routines

See Also   exp, log, sqrt
http://bbs.****.net/topics/390676437