Corresponding symbols comparison?

Sep 15, 2015 at 6:07am
For example, if you store char of symbols "( {" into a stack, how would you make a comparison to say that the correct corresponding symbols are the closing "} )" characters?

I will probably get lots of down votes because of how short my question is, but I haven't got a single clue on how to compare an open symbol to a closing symbol, nor find an efficient source online.

I'm thinking maybe I could try making a boolean function and say if '(' && ')' then return true.
Sep 15, 2015 at 6:18am
Lol this ain't stackoverflow. Ain't no downvotes up in here.

Anyways, for your question, are you trying to design a finite state machine or are you trying to overload an operator?
Sep 15, 2015 at 7:45am
If you have two variables c1 and c2 that contains the symbols that you want to check you can use an if statement like this:
 
if (c1 == '(' && c2 == ')')
Topic archived. No new replies allowed.