Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: (C++) What's this thing do?  (Read 1442 times)

0 Members and 1 Guest are viewing this topic.
(C++) What's this thing do?
« on: August 02, 2006, 06:25:44 pm »
  • You don't know me.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 234
I found something called cin.ignore on Cprogramming.com, but it seems to do the same thing as cin.get. What's the difference?
« Last Edit: March 01, 2007, 01:06:06 am by 4Sword »
Logged


No one located in this area of the internet remembers me.

Ben

Re: (C++) What's this thing do?
« Reply #1 on: August 02, 2006, 06:28:05 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 437
I'd take a guess at cin.ignore will do the crazy thing of waiting for a response and then ignore it, whilst cin.get() will store it.

But I dunno to be perfectly honest.
Logged
Want a place to upload your sprites and games for FREE? Look no further than GameDevotion
Re: (C++) What's this thing do?
« Reply #2 on: August 02, 2006, 06:46:53 pm »
  • (y)(;>.<;)(y)
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3293
I'm not sure, but I think it works like this:

cin.get() will get a charecter from the cin buffer
cin.ignore() will IGNORE the charecter, so if you call cin.get() you will get the next charecter after the ignored one.

But like I said, I'm not sure.
Logged

aab

^ Evolved from a Hobbit
Re: (C++) What's this thing do?
« Reply #3 on: August 02, 2006, 06:54:48 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 992
ignore( count, terminate )
Will ignore count input characters until terminate is found (terminate is ignored as well):
Go to: http://www.cplusplus.com/ref/
cin is an instance of the class istream, so click the istream box, and that displays the methods that cin can call, adn their meanings.

It defaults to ignore( 1, EOF ) which basically ignores the next character whatever value it is, as even if it is EOF, it will ignore it then stop as 'terminate' was found, and if it isnt, it will ignore one character then stop as it has fullfilled count==1
 
Logged




I ♥ Sol
.... I ♥ Sol ? wtf how long has that been there? >_> *rrrrrrrrar*
  • MySpace
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.061 seconds with 42 queries.