请教:用vc6.0编一个简单计算器的基本流程

来源:百度知道 编辑:UC知道 时间:2024/05/25 04:47:12
我学过c++,可是从来没编过windows界面下的程序。比如说窗口啦,按钮啦什么的~~
一下子面对这个课题有点不知从那里下手了,所以求助于各位大侠了!希望能得到些指点~

还有,我在现还需要具体再学点什么啊?
如果有人能推荐个比较好的教程那也很感谢啊!最好是有地址的(*^__^*)~~

我就不说界面了,光给个核心算法吧,支持表达式,比如(23+3*43)*2+4*(2+2)
原理?搜索关键词:编译原理,EBNF
/*
simple integer arithmetic calculator according to the EBNF
<exp> -> <term>{<addop><term>}
<addop>->+|-
<term>-><factor>{<mulop><factor>}
<mulop> -> *
<factor> -> ( <exp> )| Number
Input a line of text from stdin
Outputs "Error" or the result.
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

char token;/*global token variable*/
/*function prototypes for recursive calls*/
int exp(void);
int term(void);
int factor(void);

void error(void)
{
fprintf(stderr,"Error\n");
exit(1);
}

void match(char expectedToken)
{
if(token==expectedToken)token=getchar();
else error();
}

main()
{
int result;
tok