摘要:
#include #include #define stackinitsize 20#define stackincrement 8typedef struct{ int *base; int *top; int stacksize;}sqstack;int initstack(sqstack &s) {s.base=(int * ) malloc(stackinitsize*sizeof(int)); s.top=s.base; s.stacksize=stackinitsize; return 1; }int push(sqstack &s,int e) { ... 阅读全文
摘要:
#include #include #include "G:\JS\mystack.h"int main(){ sqstack s; int e; initstack(s); char ch; while (1) { scanf("%c",&ch); if (ch==10) break; if (ch=='(') push(s,ch); else if (ch=')') { if (em... 阅读全文
摘要:
#include #include #include "G:\JS\mystack.h"int main(){ sqstack s; int m,n,r,rod,e; initstack(s); scanf("%d %d",&n,&r); m=n; while (n) { rod=n%r; push(s,rod); n=n/r; } printf("\n\nThe resule is:%d(%d)=",m,r); while (!emptystack(s)) { pop(s... 阅读全文
摘要:
//本程序接受任意含有+、-、*、/和()的数值表达式,数值允许带小数,输入以#结束。如:((2.4+3.5)*2-(2+3.5)/2)*(2+3)##include #include "G:\express\mystack.h"char piror[7][7]={'>','>','','>', '>','>','','>', '>','>','>' 阅读全文
摘要:
#include # include "G:\express\mystack.h"char piror[7][7]={'>','>','','>', '>','>','','>', '>','>','>','>','','>', '>','>', 阅读全文
摘要:
1 #include 2 #include 3 4 #define stackinitsize 50 5 #define stackincrement 8 6 7 typedef struct { 8 int x,y; 9 }posttype;10 11 typedef struct {12 int ord;13 posttype seat;14 int di;15 }elemtype;16 17 typedef struct{18 elemtype *base;19 elemtype *top;20 int stacksize;21 }s... 阅读全文