首页 新闻 会员 周边

两个getchar()是什么意思?

0
[待解决问题]

#include <stdio.h>
int fac(int n)
{int c;
printf("now the number is %d ",n); //1
getchar(); //one
if(n==1 || n==0) c=1;
else
c=n*fac(n-1);
printf("now the number is %d and the %d! is %d",n,n,c); //2
getchar(); //two
return c;}
void main()
{
int n=4;
printf("result is %d.\n",fac(n)); }

Yingyingyang的主页 Yingyingyang | 菜鸟二级 | 园豆:210
提问于:2017-02-24 20:04
< >
分享
所有回答(2)
0

表示两次输入

花飘水流兮 | 园豆:13560 (专家六级) | 2017-02-24 20:43
0

如果是输入的话格式应该是:变量名=getchar();

我觉得是没用的,删掉就好

WDZRMPCBIT | 园豆:204 (菜鸟二级) | 2017-02-25 21:16
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册