+ 1

One more related question, how to output every character from a single word? In c++, is it possible?

String to Character

26th Jun 2022, 6:52 PM
Liza Tolentino
1 Respuesta
+ 2
string s = "ABC"; for(int i=0; i<s.length(); i++) cout << s[i] <<endl ; s[i] returns character at index i in string s. s[0] returns 'A' s[1] returns 'B' s[2] returns 'C' loop output 3 characters in separate line.
26th Jun 2022, 7:12 PM
Jayakrishna 🇮🇳