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

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/23 04:06:16
C++要求输入thisisatest输出testaisthis#include#includeusingnamespacestd;intmain(){chara[]="thisisatest";int

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
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

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;
}
边界稍微验证一下就是.