+ 1
How use space in string C++ ?
C++ String
4 Respostas
+ 2
You can use spaces normal when you create string for example string a = "hello world". If you want to get this string as input you can use std::getline(cin, string) function. It gets all line of input.
+ 1
if i use array on string, getline(cin,string[i]) can not work @SKELU21 @Baptiste E. Prunier
0
If you meant in input using cin, then use :
string s;
getline(cin,s);
0
It seems normal as string is a class, not a variable
string s[5];
for(int i = 0; i < s.size(); ++i)
getline(cin, s[i]);
Should work