+ 1
One more related question, how to output every character from a single word? In c++, is it possible?
String to Character
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.