You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
335 B
C++

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;
}