http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Using strings in C++



> 
> 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;

Wrong usage.

You could use :
	cin >> getmessage;
or
	cin.getline( getmessage, 49 );

> 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