Question: Terminated?

The book I am going through asked these questions:
What terminates input into a string?
and
What terminates an input into an integer?

I'm not sure I know what the question is asking. I think this may be the answer...

1
2
3
4
5
    string hello;
    cin>>hello;

    int number;
    cin>>number;


Any ideas?
Last edited on
The code you posted is a clarification of the question.
The end of a input to string in this context is any whitespace character.
For an integer, it is any non-numeric character.
@Chervil,

Does terminate just mean make the value invalid?
Not exactly. A space or newline or tab is a valid character in a string.
It simply means that the formatted input operation stops, and any further characters are left in the input buffer.
@Chervil,

Thanks! I'll chew on that for a bit.
Topic archived. No new replies allowed.