On 8/18/07, ashish sarode <[EMAIL PROTECTED]> wrote:
> Hello,
>
[...]
>   cin>>i;
[...]
> After running this code, if i enter a floting precision value - E.g. 2.3 for 
> i then the code goes into infinite loop.
>
> Interestingly if i enter 1.1 or 1.36 for i then the infinite loop doesnt 
> encountered - since the break statement is reached.
>
> I have tried it on Visual Studio 6.0. Can anybody tell me the reason?

You aren't checking the result of cin.


> I did also tried the same code using printf scanf but the same problem occurs 
> for this code also -
>
> Note- this is .c file
>
[...]
>   scanf ("%d", &i);

You aren't checking the result of scanf().


-- 
PJH
"Statistics are like a bikini. What they reveal is suggestive, but
what they conceal is vital"
-- Aaron Levenstein

Reply via email to