Hi Gourav,

Based on vaibhav's information concerning how to properly parse the
symbols you defined and Arsalan's tip about the use of stacks, I
managed to write code that produces the output you need. I believe I
got the
position of each character correctly. The challenge for me was to
display it in the order as indicated in your example, line-by-line.

Here's what you need to do first:

1) drop a multli-line textbox where you will input your symbols
2) drop 3 buttons.
3) name the first button as 'Parse' or any name you like.
4) name the second button as 'display' or any name you like.
5) name the last button as 'clear' or any name you like to remove
stringbuilder contents for next use.
6) labels representing values from your counters (optional).
7) drop another multi-line textbox for the messages.


Sample code can be viewed here:

http://pastebin.com/UrHBLqbR

For the stack, I'm not sure if it can store 2 or more objects like
what you can do using a Dictionary, so I created 2 stacks to make it
simple.

Feel free to modify it the way you see fit.

Regards,

Benj




On Oct 29, 4:50 pm, Gourav <[email protected]> wrote:
> Hi All,'
>    I was just making some program then i am unable to find following
> Query..
>
> Make a program in which Finding the position of opening and closing
> brackets of { }.
> Q..... { () { [ ( ) ] } { ( ) } }
> Then answer should be
> ___________________________________________
> Bracket { openning at 1 and closing at 14
> Bracket ( openning at 2 and closing at 3
> Bracket { openning at 4 and closing at 9
> Bracket [ openning at 5 and closing at 8
> Bracket ( openning at 6 and closing at 7
> and so on
> ___________________________________________

Reply via email to