PDA

Click to See Complete Forum and Search --> : How to get user input (sentences) ?


SonicWave
Mar 31st, 2002, 11:38 PM
Good day !

As far as i know, usually we will use "cin" to get the user input and store it inside a variable right ?

But now if i wish to get a sentence from a user and store it inside an array, how can I accomplish that ?

I have tried the following code :

cout << "Please enter your sentence : ";
cin >> NormalData;
cout << NormalData;

where the NormalData is the array of characters.

Let say I input "I am idiot" when it asked for input, what I got for the output is just "I" ....

I think there's a function where I can rip the whole sentence , but I forgot what's that already.

Help !

Thanks a lot !

SonicWave

parksie
Apr 1st, 2002, 11:02 AM
string str;
getline(str, cin);...IIRC.