+ 3

How do i use str::at

How do I use str.at or some other way to read string position. Example string "hello" I could read 4 position in this it would be "l"

23rd Mar 2018, 10:31 AM
JonneSir
JonneSir - avatar
2 Answers
+ 3
Eg : string s = "Hello"; cout<<s.at(4)<<endl;
23rd Mar 2018, 11:25 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 13
index of o will be 4 & posn will be 5 //btw in hello there are 2l's
23rd Mar 2018, 10:36 AM
Gaurav Agrawal
Gaurav Agrawal - avatar