|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: Using strings in C++
This is an inherent problem with Borland C++ 3.1. I dunno if it exists with others but the cin.get and cin.getline use buffered I/O and "forget" to empty the buffers once they're done. so the same input is used for both u're cin's. I suggest u use plain good ol' scanf or something else. there seems to be NO WAY to get around this problem, at least as far as i could see. :( Nikhil. --- AGUNG WIBOWO <doublegreat@Hotmail.com> wrote: > > > I have a problem to get an input from array of > string with cin.get or > cin.getline in c++. The problem i got was it is > always fail in second usage > to get string input. > > example > > char getmessage[50]; > unsigned long number; > cout<<"Input your message : "; > cin.get>>getmessage; > cout<<"Input your number : "; > cin >> number; > cout<<"Your message : " > <<getmessage; > > i put it as a member function of class that is > function to get string input > then i create to object. > for my first objek i call that function and ok > but for mysecond object i fail like this : > > input your message : input your number : > > it should ask input for string but it turn out > directly ask input for > number. > > does anybody help please ? > > > > > ______________________________________________________ > Get Your Private, Free Email at > http://www.hotmail.com > ================================================================= > The GameProgrammer.Com mailing list is for the open > discussion > of any topic related to the art, science, and > business of > programming games. This list is especially tolerant > of beginners. > We were all beginners once > > To SUBSCRIBE or UNSUBSCRIBE please visit: > http://gameprogrammer.com/mailinglist.html > > > ================================================================= > The GameProgrammer.Com mailing list is for the open > discussion > of any topic related to the art, science, and > business of > programming games. This list is especially tolerant > of beginners. > We were all beginners once > > To SUBSCRIBE or UNSUBSCRIBE please visit: > http://gameprogrammer.com/mailinglist.html > __________________________________________________ Do You Yahoo!? Thousands of Stores. Millions of Products. All in one place. Yahoo! Shopping: http://shopping.yahoo.com ================================================================= The GameProgrammer.Com mailing list is for the open discussion of any topic related to the art, science, and business of programming games. This list is especially tolerant of beginners. We were all beginners once To SUBSCRIBE or UNSUBSCRIBE please visit: http://gameprogrammer.com/mailinglist.html
|
|