hmmm...
I've just found that it has to do with the scanf("%c"); which I had 
put in to prevent the Carriage Return & Line-Feed showing on the 
string.
But I still don't understand why.... >_<


#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");
  printf("\nTransition time = %d us\n", trTime);
  getchar();
  getchar();
  return 0;
}







--- In [email protected], "boogiebehometh" <[EMAIL PROTECTED]> 
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");
>   printf("\nTransition time = %d%cs\n", trTime, 230);
>   getchar();
>   return 0;
> }
> 
> 
> Anyone can explain why?
> 
> 
> cheers,
> Paul C
>


Reply via email to