/*Write code to reverse a C-Style String (C-String means that “abcd” is represented as
five characters, including the null character )*/
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
char ch[] = "asdfdg';l2";
int p = strlen(ch)-1;
int i = 0;
while ( i < p)
{
swap(ch[i],ch[p]);
i++,p--;
}
cout<<ch<<endl;
}
careercup2
最新推荐文章于 2014-06-02 10:24:09 发布