赵宸


私信TA

用户名:chenchenchen

访问量:14292

签 名:

等  级
排  名 434
经  验 4721
参赛次数 2
文章发表 11
年  龄 0
在职情况 学生
学  校 贵州商学院
专  业

  自我简介:

#include<stdio.h>

#include<string.h>

int main()

{

char s[50],s1[100],t;//定义两个数组。

int i=0,len;

gets(s);//输入你想处理的字符串

strcpy(s1,s);//将输入的字符串拷贝到另外一个字符串里面

len=strlen(s);得到这个字符串数组长度

len-=1;

while(i<len)//对这个字符串逆序

{

t=s[i];

s[i]=s[len];

s[len]=t;

i++;

len--;

}

strcat(s1,s);//再将正反两个字符串连接到一起

puts(s1);//输出连接后的字符串

    return 0;

}


 

0.0分

2 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区

#include<stdio.h>
#include<string.h>
void fun(char x[])
{
	char y[100];
	int len=strlen(x);
	int j=0;
	for(int i=0;i<len;i++)
	{
		y[i]=x[i];
		j++;
	}
	for(int k=len-1;k>=0;k--)
	{
		y[j]=x[k];
		j++;
	}
	y[j]='\0';
	puts(y);
}
int main()
{
	char a[50];
	gets(a);
	fun(a);
	return 0;
}
2022-11-26 09:21:10
学到了学到了
2020-10-09 16:14:58
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main()
{
    char data[100];
    char temp[100];
    gets(data);
    int i,j=0;
    int length=strlen(data);
    for(i=length-1;i>=0;i--){
        temp[j]=data[i];
        j++;}
    temp[j]='\0';
    strcat(data,temp);//字符串链接,strcpy字符串复制,strcmp字符串比较!
    printf("%s",data);


}
2020-01-16 13:49:26
运行也是正确的,就是在ACM上提交不了
2018-11-22 16:19:29
#include<stdio.h>
#include<string.h>
int main()
{
	char str[60],sar[120];
	gets(str);
	strcpy(sar, str);
	strrev(str);/*为什么不能用这个函数呢?*/
	strcat(sar,str);
	puts(sar);
	return 0;
}
2018-11-22 16:15:14
十大
2018-11-22 16:14:19
  • «
  • 1
  • »