boogiebehometh wrote:
> Hi guys,
> Sorry if this is obvious to you, I'm still noob & very baffled...
> 
> Basically, I scan in a number & print it to screen - large numbers 
> become slightly smaller & small numbers become 10.
> 
> 200 becomes 10
> 2000 becomes 1802
> 20000 becomes 19978
> 200000 becomes 199946
> 
> I'm using the Dev C++ Compiler Version 4.9.9.2
> unsigned long is shown here, but i get the same results with int & 
> long...
> 
> Here's the code:
> 
> #include <stdio.h>
> #include <string.h>
> 
> int l;
> int main ()
> {
>   int l;
>   unsigned long trTime=0, trTime2=0, step=0;
> 
>   printf("\nEnter Transition Time(%cs): ",230);
>   scanf("%d",&trTime);
>   scanf("%c");

Probably because you didn't read the documentation on how to use 
scanf().  Every '%something' must have a parameter or you get undefined 
behavior.

>   printf("\nTransition time = %d%cs\n", trTime, 230);
>   getchar();
>   return 0;
> }
> 
> 
> Anyone can explain why?
> 
> 
> cheers,
> Paul C


-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to