+ 1

Given a word. How to find it's third symbol in cpp?

I couldn't find the solution in the solo learn

23rd May 2018, 9:06 AM
Alisher
2 ответов
+ 6
By symbol, do you mean character? char *word = "absolute"; cout << "Third is '" << word[2] << "'." << endl; Outputs: Third is 's'.
23rd May 2018, 9:18 AM
John Wells
John Wells - avatar
+ 1
let's say your word variable is called "word" and has the value "Hello" cout << word[2] << endl;//outputs "l".
23rd May 2018, 8:46 PM
Paul Grasser
Paul Grasser - avatar