+ 2

How to cin string & how to get the string length ?

30th Jun 2017, 10:58 PM
Githesh
Githesh - avatar
6 odpowiedzi
+ 2
yes@immortal
30th Jun 2017, 11:29 PM
Githesh
Githesh - avatar
+ 2
tnx @immortal
30th Jun 2017, 11:36 PM
Githesh
Githesh - avatar
+ 2
It depends on what string type you're talking about. There are many types of strings for example: 1.....const char* you can use strlen() [ const char *str = "hello"; std::cout << str << ":" << strlen(str); ] 2....std::string you can use .size() or .length() methods. [ std::string str = "hello"; std::cout << str << ":" << str.length(); ] ....
30th Jun 2017, 11:40 PM
yassou
yassou - avatar