长整数四则运算,可用链表或数字组或栈实现,用文件的形式完成输入输出
来源:百度知道 编辑:UC知道 时间:2024/06/25 15:35:42
一百位以上长整数四则运算,可用链表或数字组或栈实现,用文件的形式完成输入输出,用C++运行
请高手指教!
请高手指教!
#include <stdio.h>
#include <malloc.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#define M 40
/*定义堆栈*/
typedef struct{
double data[M];
int top;
}Stack;
/*初始化堆栈*/
InitStack(Stack *s)
{
s->top=0;
}
/*判断栈是否为空*/
int StEmpty(Stack *s)
{
if(s->top==0)
{
return 1;
}
else
{
return 0;
}
}
/*入栈操作*/
StPush(Stack *s,double x)
{
if(s->top==M)
{