#include<stdio.h>
#include<iostream>
#include<iterator>
#include<vector>
#include<string>
//#include<iomanip>
using namespace std;
void reverse(char *s)
{
int len = strlen(s) - 1, i = 0;
char tmp;
while (i!=len && i<len)
{
tmp = s[i];
s[i] = s[len];
s[len] = tmp;
i++;
len--;
}
}
/*
void reverse3(char *s)
{
int len = strlen(s), i; 考虑用指针交换??
char *temp;
for (s; s < s + len; s++,len--)
{
}
}
*/
/*
void reverse2(vector<string>s)
{
auto sbegin = s.begin(); begin,end,等是vetcor里的函数
auto send = s.end();
//char temp;
cout << "orginal is " << endl;
for (auto it = sbegin; it != send; it++)
cout << *it << " ";
cout << endl;
cout << "result " << endl;
for (auto it = send - 1; it >= sbegin; it--)
cout << *it << " ";
cout << endl;
}
*/
void main()
{
char s[] = "abcdefgh";
cout << "the orginal is " << s << endl;
reverse(s);
cout << "the result is " << s << endl;
getchar();
/*
char* str[] = { "a","b","c" };
vector<string> s (str,str+3);
reverse2(s);
return ;
*/
}