Thread: Formatted input

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    113

    Formatted input

    I want to input two variables like a/b.One book suggest this as
    Code:
    int a,b;
    char dummychar;
    cin>>a>>dummychar>>b;
    Can anyone explain why above code gives the desired result.Also is there any other way out.In C we used to do it as

    Code:
    scanf("%d/%d",&a,&b);
    Also please give me a link to other aspect of formatted input in C++.
    Last edited by vaibhav; 10-22-2005 at 03:04 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can someone help me with these errors please code included
    By geekrockergal in forum C Programming
    Replies: 7
    Last Post: 02-10-2009, 02:20 PM
  2. I would love some input on my BST tree.
    By StevenGarcia in forum C++ Programming
    Replies: 4
    Last Post: 01-15-2007, 01:22 AM
  3. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  4. Structure and Linked List User Input Question
    By kevndale79 in forum C Programming
    Replies: 16
    Last Post: 10-05-2006, 11:09 AM