String Character Access in C++
Level 258 keystrokes
Reads single characters of "Hello" by index and prints the first and the last, Ho, on one line.
C++ code
// Stores "Hello" in the string word (indexes 0 to 4)1string word = "Hello";// word[0] is the char 'H' and word[4] is 'o'// No space or newline is inserted between them, so Ho is printed2cout << word[0] << word[4] << endl;Output
Ho
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.
<× 6;× 2"× 2[× 2]× 2=× 1