+ 4
how can we input string with space in c++ ?
5 Respostas
+ 5
cin.getline(variableName, maxsize);
ex
char name[40];
cin.getline(name,40);
+ 4
The Standard Library provides an input function called ws, which consumes whitespace from an input stream. You can use it like this:
std::string s;
std::getline(std::cin >> std::ws, s);
+ 1
@GAWEN STEASY....if we want to use each character of the element by its index ...e.g.
string a;
a[0]=d;
can we do the same with that to...can you please give me a short code..
+ 1
Use [A-Z,a-z, ""]
+ 1
@riya runjhun you can do this easily in python using each in sentence in for loop where as you can split the words in character as like array and use index zero for the same purpose