programming-examples/c++/Others/Accessing Character Elements of an STL String.cpp

18 lines
335 B
C++
Raw Normal View History

2019-11-15 12:59:38 +01:00
Accessing Character Elements of an STL String
#include <string>
#include <iostream>
int main(){
using namespace std;
string str ("Hello String");
for(size_t i = 0; i < str.length(); ++ i){
cout << "Character [" << i << "] is: ";
cout << str [i] << endl;
}
cout << endl;
return 0;
}