回复 9楼 阿维
输入了五个字符后,为什么是倒叙输出的
2015-03-18 16:41
程序代码:
/* 输入一段字符串 然后反向打印该字符串 */
#include <stdio.h>
#include <windows.h>
#include <string.h>
void main()
{
char My_str[50];
int i;
system("title 输入一段字符串 然后反向打印该字符! ");
printf("please input a string:");
scanf("%s",My_str);
i=strlen(My_str);
printf("原字符:%s\n",My_str);
printf("该字符长度:%d bate!\n",i);
printf("反向后的字符:");
for(;i>=0;i--){
printf("%c",My_str[i]);
}
printf("\n");
system("pause");
}
2015-03-18 18:47
2015-03-18 19:37
2015-03-18 19:42
2015-03-18 21:49
2015-03-20 21:16
2015-03-20 21:21