From 0a1824fe83450832d9b3c75ec64fe276a6d3c134 Mon Sep 17 00:00:00 2001 From: bala <13452927+rfgsdhshgfh@user.noreply.gitee.com> Date: Sat, 13 Jan 2024 14:46:13 +0000 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E9=A1=BA=E5=BA=8F=E6=A0=88?= =?UTF-8?q?=E7=9A=84=E5=90=84=E7=A7=8D=E5=9F=BA=E6=9C=AC=E8=BF=90=E7=AE=97?= =?UTF-8?q?=E7=9A=84=E7=AE=97=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: bala <13452927+rfgsdhshgfh@user.noreply.gitee.com> --- ...7\347\232\204\347\256\227\346\263\225.cpp" | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 "2224020152/\347\254\254\344\270\211\345\215\225\345\205\203/\345\256\236\347\216\260\351\241\272\345\272\217\346\240\210\347\232\204\345\220\204\347\247\215\345\237\272\346\234\254\350\277\220\347\256\227\347\232\204\347\256\227\346\263\225.cpp" diff --git "a/2224020152/\347\254\254\344\270\211\345\215\225\345\205\203/\345\256\236\347\216\260\351\241\272\345\272\217\346\240\210\347\232\204\345\220\204\347\247\215\345\237\272\346\234\254\350\277\220\347\256\227\347\232\204\347\256\227\346\263\225.cpp" "b/2224020152/\347\254\254\344\270\211\345\215\225\345\205\203/\345\256\236\347\216\260\351\241\272\345\272\217\346\240\210\347\232\204\345\220\204\347\247\215\345\237\272\346\234\254\350\277\220\347\256\227\347\232\204\347\256\227\346\263\225.cpp" new file mode 100644 index 00000000..a3eb2c2a --- /dev/null +++ "b/2224020152/\347\254\254\344\270\211\345\215\225\345\205\203/\345\256\236\347\216\260\351\241\272\345\272\217\346\240\210\347\232\204\345\220\204\347\247\215\345\237\272\346\234\254\350\277\220\347\256\227\347\232\204\347\256\227\346\263\225.cpp" @@ -0,0 +1,49 @@ +#include +#include +#define MaxSize 50 +typedef int ElemType; +typedef struct{ +    ElemType data[MaxSize];             +    int top;                 +}SqStack;  + + +void InitStack(SqStack *&s){ +    s=(SqStack *)malloc(sizeof(SqStack)); +    s->top = -1;       + + +void DestroyStack(SqStack *&s){ +    free(s); +}  + + +bool StackEmpty(SqStack *s){ +    return(s->top == -1);     +}  + + +bool Push(SqStack *&s,ElemType e){ +    if(s -> top == MaxSize -1)          +        return false; +    s->top++;               +    s->data[s->top] = e;         +    return true; +}  + + +bool Pop(SqStack *&s,ElemType &e){ +    if(s->top == -1) +        return false; +    e=s->data[s->top];       +    s->top--;               +    return true; +}  + + +bool GetTop(SqStack * s,ElemType &e){ +    if(s->top == -1) +        return false; +    e=s->data[s->top];           +    return true;             +} \ No newline at end of file -- Gitee