Страница 1 из 1

Консольное приложение, баланс скобок со стеком

Добавлено: 13 апр 2013, 22:11
MakeMeDown
собственно вот мой стек

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class stack
{
public int maxStack;
public string[] s;
public int top = 0; // == number of elems. So [0] not used

public stack(int maxSize)
{
maxStack = maxSize;
s = new string[maxStack + 1];
}

public stack()
: this(10)
{
}

public bool push(string a)
{
if (top >= maxStack) return false;
top++;
s[top] = a;
return true;
}

public bool empty()
{ return (top == 0); }

public string pop()
{
if (top == 0)
return "*EMPTY*";
string res = s[top];
top--;
return res;
}

}
class Program

напишите пожалуйста сlass Program для баланс скобок, очень надо