Encapsulating a stack with arrays and generics that can hold a specified type of LIFO FILFO .

Updated on technology 2024-04-08
5 answers
  1. Anonymous users2024-02-07

    I do it with LinkedList do you want to.

  2. Anonymous users2024-02-06

    class stack

    top=-1;Stack top indication.

    void push( int item) pushes the element into the stack top ++

    stack[top ] = item;

    int pop() stacks, the top element of the stack goes out of the stack and returns.

    top--;

    return stack[top+1];

    int peek( ) takes the current top element of the stack s and returns.

    return stack[top];

    void clearstack() destroys stack top = -1;

    maxsize = 0;}}

  3. Anonymous users2024-02-05

    You can use an indefinite-length array to store data, and when you take it, test the length of the array first, and then take the data according to the length.

  4. Anonymous users2024-02-04

    dim a() creates an array of indefinite length, but the upper and lower limits of a() must be redefined when assigned or called.

    The following x and y are assigned where they are used, i.e., the upper and lower limits of the a() array.

    x=1 'a() array.

    y=10 ''a() array.

    The following statement redefines the a() array to the desired length.

    redim a(x to y)

    Assign a value to a().

    for i=lbound(a) to ubound(a)a(i)=i

    next'Invoke.

    msgbox a(ubound(a)) shows the value of the last element of a().

  5. Anonymous users2024-02-03

    #include

    #define initsize 20

    #define increment 10

    typedef char elemtype;

    typedef struct stackstack;

    void initstack(stack &s) initializes the stack into the stack, and appends the stack space when the stack is full.

    int empty(stack &s) Void clear(stack &s).

    void conversion(int n,int n) base conversion}while(!empty(s))

    clear(s);

    void main()

Related questions
22 answers2024-04-08

The chin is pointed and the face is thin, for example, the melon seed face belongs to the V-shaped face

15 answers2024-04-08

ints need to be expressed according to the size of the compiler. >>>More

14 answers2024-04-08

Hello! Here's how you can tell if a tire needs to be replaced >>>More

4 answers2024-04-08

Now they are all multi-functional smart machines,LZ your requirements are very high,At least the power bank currently used by smart machines is not so powerful...

39 answers2024-04-08

1.Move to another city

2.Destroy everything that reminds you of the other person or touches the scene: letters, etc. 3Open your heart and accept other boys >>>More