string::at

char& at (size_t pos);
const char& at (size_t pos) const;

#include <string>
#include <iostream>

using namespace std;
int main()
{
string s1("test");
for(unsigned int i = 0; i < s1.length(); ++ i)
{
cout << s1.at(i) << " ";
}
cout << endl;
return 0;

posted @ 2019-12-23 10:25  MoonXu  阅读(159)  评论(0编辑  收藏  举报