Results 1 to 2 of 2

Thread: easy *hopes* cin question

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    54

    easy *hopes* cin question

    Hey,
    I've been looking all over for this, but is there a way to cin an integer and ignore any other symbols i enter before or after it?

    Like for ex:

    int a,b;
    cin >>a >>b;

    if I enter "(3,4)". a is not 3, and b is not 4. Is there some kind of flag to set cin to only accept integers.

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Um, no. Just read everything you want in succession (or use an expression parser...)
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width