Search:

Type: Posts; User: Alexius Lim

Search: Search took 0.01 seconds.

  1. Replies
    5
    Views
    2,539

    This is what i got. while (getline(cin,...

    This is what i got.


    while (getline(cin, line))
    {
    stringstream ss(line);
    if (ss >> input && ss.eof() && (input == 1 || input == 2))
    {
    break;
    ...
  2. Replies
    5
    Views
    2,539

    what about the validation for input != 1 &&...

    what about the validation for
    input != 1 && input != 2 now that the datatype is stringstream, how do i check if the input is 1 or 2?
  3. Replies
    5
    Views
    2,539

    input validation

    I have this simple code for input validation where the only options are 1 and 2. But if the user entered a character, the loop becomes never-ending. How do i validate for incorrect input datatype?
    ...
Results 1 to 3 of 3