Problem with string.

Hi,
i have the variable s wich type is string.
the value of s is
string s = "Doljenli bit bluetooth v telefone?";
The problem is, i can't take only words like
the code
string g = s[0]; //i want g=Doljenli
but it didn't work
please help!






I would use .find() and find the first space, and then use .substr() in order to get everything up to that first word (or wherever you want to start/end)

http://www.cplusplus.com/reference/string/string/
Last edited on
try with string bibliothek (#include <string.h>). you can do whatever you want with strings
Topic archived. No new replies allowed.