You really have to give a lot more information in order to enable me to help you. However, by wild guessing, I am trying to nudge you into the right direction.
I assume you are trying to program a simple + - * / = infix calculator with or without a graphical user interface.
To get operators and operator precedence right, it is a good idea to create to a data structure of type stack. Stacks are abstract containers with operations push(), pop() and isempty().
- Push() puts a new object to the stack,
- Pop() removes one object from the stack and returns it, unless the stack is empty, in which case an error is generated,
- isempty() is a boolean function that checks if the stack is empty.
A nice-to-have convenience extra is an operation top(). It returns the topmost stack element without removing it (you can emulate by a pop(); push() sequence at some performance costs, so its not a strict requirement for a stack).
Stacks are LIFO memories, Last In, First Out, so what you push most recently will get returned by pop first. Just like a stack of cards where you can put a new card only to the top and take away from the top, too.
Processing of the input is done according to the "Shunting-Yard Algorithm
", invented by Edsger Wybe Dijkstra. The link directs you to the Wikipedia page of the algorithm, which does an extensive discussion, much nicer than what I could do here on FixYa.