急求一C语言编的计算器代码

来源:百度知道 编辑:UC知道 时间:2024/05/29 01:33:40
有图形界面并能进行带括号的混合运算就OK 谢谢了
java或 c++也可以 其他的暂时还没接触...

#include<stdio.h> /*库文件包含*/
#include<string.h> /*用于字符串操作*/
#include<stdlib.h> /*用于exit函数*/

/**************************************************************************
int check(char *c)
输入参数:
char *c: 输入的字符串
返回参数:
0:字符串中有不符合规定的字符
1: 字符串字符符合规定,没有不符合规定的字符.
功能:
检查字符串中有否除了 0-9, +,-,*,/,(,),之外的其他字符,
如果有,则返回0, 表示出现错误。
若没有,则返回1,表式字符串符合规定。
**************************************************************************/
int check(char *c)
{
int k=0;
while(*c!='\0')
{
if((*c>='0' && *c<='9') || *c=='+' ||
*c=='-' || *c=='*' || *c=='/' ||
*c=='.' || *c=='(' || *c==')' )
{

}
else
{
printf("input error, there have the char not the math expression char!\n");
return 0;
}

if(*c=='('