大虾们求救拉!!!c++分数计算器

来源:百度知道 编辑:UC知道 时间:2024/04/27 22:15:25
3.2.1 程序功能简介
分数计算及测试程序,具有对输入的运算进“+,-,*,/,^”的功能。
3.2.2 课程设计要求
(1)将主程序设计成一个分数计算器。
(2)可完成“+,-,*,/,^”等基本运算。
(3)可将分数化为十进制小数和带分数。
(4)可执行“+,-,*,/,^”(含括号的)四则运算。
3.2.3 课程设计说明
(1)编写程序时,建议用两个数组分别来存放相邻的输入数据。
(2)每个运算符的前后可能出现的其它运算符,应该作相应的处理。
(3)四则运算要符合一定的格式,例如1/2+2/3*3/4+(1/2+2/3*3/4)+1/2^2/1#其中约定:①符号‘#’用于表示输入结束②符号‘^’为乘方符号。

源程序后面要有注释,越多越好啦~~~
还要把结果写到文本文档里再读出来
很难,之前在网上找到的那个是错的,书后答案也是错的,急死了。
下周就要交
大虾们帮忙拉!
有一个错误和一个警告呢。。。
而且那个看不懂。。。T_T

实现表达式求解功能,你先看看:有需要yssemails@163.com
复制,编译 运行 就可以了
#include <stdio.h>
#include "malloc.h"
#include "string.h"
typedef char datetype1;
typedef struct dateare1{
datetype1 elem;
struct dateare1 *forth;
}datestruct1;
typedef struct {
datestruct1 *base,*top;
int length;
}OPTR;
typedef int datetype;
typedef struct sdateare{
datetype elem;
struct sdateare *forth;
}datestruct;
typedef struct {
datestruct *base,*top;
int length;
}OPND;
OPND createOPND(){
OPND L;
datestruct *p;
p=(datestruct *)malloc(sizeof(datestruct));
if(p)
{L.base=p;
L.top=p;
L.top->forth=NULL;
L.length=0;
return L;}
else {printf("\nINITSTACK ERROR");exit(0);}
}
void pushOPND(OPND *Lsp,datetype e) {datestruct *p;