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/05/19 12:14:20
C++ 要求输入this is a test 输出test a is this#include #include using namespace std; int main() { char a[]= =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

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