YyOo @ 2023-07-25 20:12:11
#include <stdio.h>
#include <stdlib.h>
int main()
{
char c[10];
int i;
scanf("%s",c);
for (i =10; i >= 0; i--)
{
printf("%c", c[i]);
}
return 0;
}
by Bingxiu @ 2023-07-25 20:15:08
@YyOo i=strlen(c)-1
by zhangyuanxiao @ 2023-07-25 20:15:18
@YyOo 那个数组后面会有没有初值(没输入的部分),那部分不用输出
by zhangyuanxiao @ 2023-07-25 20:16:45
@YyOo 改成:
i=4;
by zhangjiahang789 @ 2023-07-25 20:27:15
@YyOo 直接倒着输出不行吗?
by zhangyuanxiao @ 2023-07-25 20:28:12
@zhangjiahang789 他就是倒着输出的啊
by zhangjiahang789 @ 2023-07-25 20:30:27
@zhangyuanxiao
对啊,我看楼主弄得好麻烦,我想的是
cin>>a>>b>>c>>d;
cout<<d<<c<<b<<a;
(有可能我的方法太蠢了,大佬勿喷)
by wangsitan @ 2023-07-31 13:12:31
@zhangjiahang789 小数点
by zhangjiahang789 @ 2023-07-31 15:43:15
@wangsitan 啊,对,用scanf,printf就好了