String Length in C++
Level 259 keystrokes
Calls length() on the string "Hello World" and prints its number of characters, 11 (the space counts too).
C++ code
// Stores the text "Hello World" in the string variable text1string text = "Hello World";// length() returns the number of characters in the string// 5 letters + 1 space + 5 letters = 11, so 11 is printed2cout << text.length() << endl;Output
11
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this C++ code and how often they appear.
<× 4;× 2"× 2.× 1(× 1)× 1=× 1