作业帮 > 综合 > 作业

C++ 要求输入this is a test 输出test a is this

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/17 03:02:03
C++ 要求输入this is a test 输出test a is this
#include
#include
using namespace std;
int main()
{
char a[]= "this is a test";
int n=strlen(a);
int temp=n;
\x05int i;
for(i=n;i>=0;i--)
{
if (a[i]==' ')
{
for(int j=i+1;j
直接逆置字符串就是(不管'\0').
for(i = 0,j = strlen(s)-1; i < strlen(s)/2; ++i,--j)
{
t = s[i];
s[i] = s[j];
s[j] = t;
}
边界稍微验证一下就是.