我自己写的,肯定有不足的地方,还请各位大佬们指教
C++:
#include<iostream>
#include<string.h>
#include <string>
using namespace std;
int main()
{
char w[100];
cin.getline(w,100);//输入一整行包括空格
//置换
int start = 0;
int end = strlen(w)-1;
for (int temp;start<=end;)
{
temp = w[start];
w[start] = w[end];
w[end] = temp;
start++; end--;
}
//输出
int i = 0;
for (; i < strlen(w); i++)
{
cout << w[i];
}
return 0;
}