乙酸的密度是多少:利用Mid函数和循环结合,将输入的字符串以反序显示.

来源:百度文库 编辑:神马品牌网 时间:2024/04/28 06:58:14
例如,输"abcde",显示"edcba"

#include "stdio.h"
main()
{char t,a[100];
int i,j;
gets(a);
for(i=0,j=strlen(a)-1;i<j;i++,j--)
{t=a[i];a[i]=a[j];a[j]=t;}
puts(a);
}

Dim a, b
a = "abcde"

b = StrReverse(a)

string a,b,c
int i,j
i=length(a)
for j=1 to i
c=mid(a,j,1)
b+=c
next
messagebox("结果",b)