qazmlp1209@rediffmail.com wrote:[color=blue]
> FAQ at
> "http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.6"
> states that the following program will not work properly:
> ---------------
> int main()
> {
> char name[1000];
> int age;
>
> for (;;)
> {
> std::cout<< "Name: ";
> std::cin >> name;
> std::cout<< "Age: ";
> std::cin >> age;
> }
> }
> ---------------
>
> But,if I run the above program on my machine, it works without any
> problems.[/color]
What input are you giving it?
[color=blue]
> So, does it mean that, keeping the 'non-digit character
> within buffer' problem is a random behaviour exhibited by some/all
> systems?[/color]
No.
[color=blue]
> I could understand that, 'ignore()' of non-digit characters
> that are left behind, is safer. But, I would like to know what exactly
> is the case without that.[/color]
Try giving it some garbage instead of an integer when 'age' is requested.
V