Like Tree1Likes
  • 1 Post By laserlight

Simple cin clarification

This is a discussion on Simple cin clarification within the C++ Programming forums, part of the General Programming Boards category; What are the differences and similarites between Code: cin>>charx; and Code: cin.get(charx); Thanks in advance!...

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    86

    Simple cin clarification

    What are the differences and similarites between
    Code:
    cin>>charx;
    and
    Code:
    cin.get(charx);
    Thanks in advance!

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    2,560
    What do you think is the difference? By the way the second snippet is wrong, you should be passing the address of the character.


    Jim

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,968
    Quote Originally Posted by jimblumberg
    By the way the second snippet is wrong, you should be passing the address of the character.
    No, it is correct, assuming that charx is a char, since the corresponding parameter is a reference to char.
    jimblumberg likes this.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    May 2010
    Posts
    2,560
    Right, don't know what I was thinking.

    Jim

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple loop clarification
    By figarojones in forum C Programming
    Replies: 2
    Last Post: 12-10-2012, 03:04 AM
  2. Very simple clarification about strings (I hope).
    By figarojones in forum C Programming
    Replies: 3
    Last Post: 11-12-2012, 03:42 PM
  3. Clarification....
    By CommonTater in forum C Programming
    Replies: 4
    Last Post: 09-23-2010, 05:39 PM
  4. Help! Need some clarification.
    By jaro in forum C Programming
    Replies: 2
    Last Post: 04-08-2006, 11:44 AM
  5. Need a clarification here
    By bithub in forum A Brief History of Cprogramming.com
    Replies: 30
    Last Post: 12-27-2004, 12:06 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21