佣金计算公式服务行业:C语言编程:输入字符串,倒序输出

来源:百度文库 编辑:中科新闻网 时间:2024/04/29 09:31:04
C语言编程:输入字符串,倒序输出 如输入ABC 输出CBA

#include<stdio.h>
#include<string.h>
main()
{
char str[100];
int n;
printf("input string:");
gets(str);
n=strlen(str);
for(;n>=0;n--)printf("%c",str[n]);
getch();
}

输入ABC 输出CBA

main()
{char *p,str[100];
p=str;
printf("输入\n");
scanf("%s",p);
while(p!='')
{printf("%c",*p);
p--;
}
}

不知道行不行 偶也新手

数据结构...堆栈....

用数组来解决