| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2654 人关注过本帖
标题:这是一个计算器程序 请各位高手帮我画一个流程图
只看楼主 加入收藏
C语言菜鸟
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2004-12-23
收藏
 问题点数:0 回复次数:1 
这是一个计算器程序 请各位高手帮我画一个流程图

#include<Stdio.h> #include<Stdlib.h> #include<ctype.h> char token; void error(void) { printf("stderr:FALSE\n"); exit(1); } void match(char expectedToken) { if(token==expectedToken) token=getchar(); else error(); } int exp(void) {

int temp=term(); while ((token=='+')||(token=='-')) switch(token){ case'+': match('+'); temp +=term(); break; case '-': match('-'); temp -=term(); break; } return temp; } int term() { int div; int temp=factor(); while ((token=='*')||(token=='/')) switch(token) { case'*': match('*'); temp*=factor(); break; case'/':match('/'); div=factor(); if(div==0) { printf(stderr,"shuchuwei 0.\n"); exit(1); } temp /=div; break; } return temp; } int factor(vodi) { int temp; if (token=='(') { match('('); temp=exp(); match(')'); } else if (isdigit(token)) { ungetc (token,stdin); scanf("%d",&temp); token=getchar(); } else error(); return temp; } main() { int result; printf("play a bey: "); token= getchar(); result=exp(); if(token=='\n') printf("jueku%d\n",result); else error(); puts("play any key for ending ..."); getch(); return 0; }

搜索更多相关主题的帖子: 计算器 token 流程图 void term 
2004-12-23 22:50
zinking
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:35
帖 子:916
专家分:0
注 册:2004-12-5
收藏
得分:0 

大哥你认为这可能吗?

我写程序都是意识流阿。况且,你都写不出,让别人怎么 帮你阿。

这种问题,。。。。伤脑经阿!!!


http://kongfuziandlife. http://codeanddesign.
2004-12-25 13:08
快速回复:这是一个计算器程序 请各位高手帮我画一个流程图
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018726 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved