|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] RE: Using strings in C++
>You could use :
> cin >> getmessage;
>or
> cin.getline( getmessage, 49 );
Thank's to chen gang but actually that is what i mean may be i am too sleepy
to code cin.getline in my first email.
i wonder why that function just succesfully in first usage but always fail
in second usage for example :
#include <conio.h>
#include <iostream.h>
int main(void)
{
char input[50];
clrscr();
cout<<"What is your name ";
cin.getline(input,sizeof(input));
cout<<"your name : "
<<input<<endl;
cout<<"what is your address : ";
cin.getline(input,sizeof(input));
cout<<"your address : "
<<input<<endl;
getch();
return (0);
}
the result :
what is your name : (ask input succesfully done);
but in second usage
what is your address : your address:
(fail to ask input and it directly continue to write your address)
if my compiler was error ??????
does anybody help ????
______________________________________________________
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
|
|