Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок0
How to separate the fullname "John Doe" and assign "John" to firstname and "Doe"to lastname?
separating fullname in firstname and lastname
2 ответов
+ 3
In other languages you would use split().
https://stackoverflow.com/questions/5888022/split-string-by-single-spaces
+ 4
You can use strtok function for that
http://www.cplusplus.com/reference/cstring/strtok/
Since strtok is a C language function so it handles character array not strings. To convert string into char array use (string).c_str function
http://www.cplusplus.com/reference/string/string/c_str/