c+*用指针编写fanxu函数,将输入字符串(仅包括英文数字,不含中文)反序输出)
c++初学者!谢谢各位啦!
函数还在摸索阶段,希望有大神可以回复
#include<bits/stdc++.h>
using namespace std;
const int maxlen=1e5 + 10;
void fanxu(char *s, int len){
char* p = s + len - 1;
do
{
putchar(*p);
p--;
}while(p>=s);
}
int main()
{
int len;
char sm[maxlen];
cin >> sm;
len = strlen(sm);
fanxu(sm, len);
return 0;
}