+ 1
Given a word. How to find it's third symbol in cpp?
I couldn't find the solution in the solo learn
2 Answers
+ 6
By symbol, do you mean character?
char *word = "absolute";
cout << "Third is '" << word[2] << "'." << endl;
Outputs:
Third is 's'.
+ 1
let's say your word variable is called "word" and has the value "Hello"
cout << word[2] << endl;//outputs "l".