计算器代码无法实现运算

CAIJING123456 2009-02-12 03:48:07
# include<stdio.h>
char token;
void match(char expectedToken)
{if(token==expectedToken) token=getchar();
else
{printf("cannot match\n");
exit(1);
}
}
int low(void)
{int result=mid();
while((token=='+')||(token=='_'))
if(token=='+')
{match('+');q
result+=mid();
break;
}
else if(token=='-')
{match('-');
result-=mid();
break;
}
return result;
}

int mid(void)
{int div;
int result=high();
while((token=='*')||(token=='/'))
if(token=='*')
{match('*');
result*=high();
break;
}
else if(token=='/')
{ match('/');
div=high();
if(div==0)j
{ printf("the dived is 0\n");
exit(1);
}
我是一名初学者,这是计算器代码,复杂的四则运算运行无结果。我想计算器中有时间显示的功能,怎么做?
...全文
57 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
lzonline01 2009-02-13
  • 打赏
  • 举报
回复
看看Windows核心编程,做点有界面的出来

70,037

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧