[ create a new paste ] login | about

Link: http://codepad.org/ETfGGL3A    [ raw code | fork ]

iamyeasin - C++, pasted on Apr 6:
//Using custom stack implementation with array

#include<stdio.h>
#define sf scanf
#define pf printf

int st[1024];
int top=0;

void push(int task)
{
    st[top++] = task;
}

int pop()
{
    top--;
    return st[top];
}


int main()
{
    int kase,t,mx=0;
    sf("%d",&kase);

    while(kase--)
    {
        int n;
        sf("%d",&n);
        while(n--)
        {
            sf("%d",&t);
            push(t);
            if(t>mx) mx = t;
        }

        pf("Ordering: ");
        while(top>0)
        {
            pf("%d ",pop());
        }
        pf("\nMax: %d\n",mx);

        top = 0;
        memset(st,0,sizeof(st));
        mx=0;
    }


    return 0;
}


Create a new paste based on this one


Comments: