search 登录 注册
arrow_back返回列表
ID:86898
light_modedark_modestarstarstar
Lv.1 韶华一笑间
edit_note帖子 214
stars积分 13,626
event加入 2011-12-10
电脑网络

经典C语言程序设计100例【程序27】

schedule发表于 2013-11-20 12:20:00 visibility查看 398 chat_bubble回复 0
#1 楼主
题目:利用递归函数调用方式,将所输入的5个字符,以相反顺序打印出来。
1.程序分析:
2.程序源代码:
#include “stdio.h“
main()
{
int i=5;
void palin(int n);
printf(“\40:“);
palin(i);
printf(“\n“);
}
void palin(n)
int n;
{
char next;
if(n<=1)
  {
  next=getchar();
  printf(“\n\0:“);
  putchar(next);
  }
else
  {
  next=getchar();
  palin(n-1);
  putchar(next);
  }
}
forum
暂无回复,快来抢沙发!
登录 后才能回复