tags:

views:

115

answers:

3

i want to store a string entered by the user including the space characters into the following array

char array[100];

how can i do it.

+3  A: 

You can use the following to get the user-entered string to a string object, then convert it to whatever you need:

string c;
getline(cin, c);
frbry
+2  A: 
cin.getline(array, 100, '\n');
Sani Huttunen
what this means explain??
Zia ur Rahman
@Zia ur Rahman: Stackoverflow can give you a hint into the right direction, but we cannot teach you the language. You won't have a chance to learn C++ without having a textbook to your aid to explain the things pointed out here. (BTW: I'd strongly suggest you abandon the idea of using character arrays. Use strings instead as shown in frbry's answer: http://stackoverflow.com/questions/2111292/2111339#2111339)
sbi
A: 

Documentation for getline can be found here: http://cplusplus.com/reference/iostream/istream/getline/

xzqx