当前位置: 代码迷 >> C语言 >> 大师的程序有点吃力,指点下咯:)
  详细解决方案

大师的程序有点吃力,指点下咯:)

热度:281   发布时间:2007-07-03 01:57:07.0
大师的程序有点吃力,指点下咯:)

#include<ctype.h>
int getch(void);
void ungetch(int);
int getop(char s[])
{
int i,c;
while((s[0]=c=getch())==' '||c=='\t')
; 1.---输入非' '或 '\t'是while结束,s[1]='\0';程序就return '0',下面的那些if 不是多余?

s[1]='\0';
if(isdigit(c)&&c!='.')
return c;
i=0;
if(isdigit(c))
while(isdigit(s[++i]=c=getch()))
;
if(c=='.')
while(isdigit(s[++i]=c=getch()))
;
s[i]='\0';
if(c!=EOF)
ungetch(c);
return ‘0’;
}

搜索更多相关的解决方案: 大师  

----------------解决方案--------------------------------------------------------
你的代码没有缩进怎么看阿
输入非' '或 '\t'是while结束,s[1]='\0';程序就return '0',下面的那些if 不是多余?????
那条if多余??我没看出来阿


----------------解决方案--------------------------------------------------------
  相关解决方案