This should do you, it puts everything in postfix, the setupword method that it uses just converts operators like + and - to other things so you don't need that.
I also don't feel real bad about you not getting the full learning experience of doing it yourself because this is in C, but it should give you the basic idea.
long intopost (Stack * stack1) {
Stack * temp_stack;
char character;
long value;
long parenth_counter = 0;
long from_setupword;
temp_stack = new_Stack(CALCSTACKSIZE);
empty_Stack(stack1);
/* This loop calls the data entered and performs the appropriate
task on what was entered. It reads in numbers and
operators. */
while (1) {
character = getchar();
if (character == EOF){
delete_Stack(&temp_stack);
return EOF;
}
/* The '\n' signals the loop that the user is done
entering data and all things that are left on
temp_stack are moved onto stack1. */
if (character == '\n') {
while (! isempty_Stack(temp_stack)) {
pop(temp_stack, &value);
push(stack1, value);
}
break;
pop(temp_stack, &value);
if (CHARACTER(value) == '(') {
parenth_counter--;
break;
}
push (stack1, value);
}
continue;
}
/* This block takes care of all the other operators.
(ie. + - * / ^ !) */
else {
if (isempty_Stack(temp_stack))
push(temp_stack, setupword(character));
else {
from_setupword = setupword(character);
top(temp_stack, &value);
if(PRIORITY(from_setupword) > PRIORITY(value))
push(temp_stack, from_setupword);
else {
while (PRIORITY(from_setupword) <=
PRIORITY(value)) {
pop(temp_stack, &value);
push(stack1, value);
if(isempty_Stack(temp_stack))
break;
top(temp_stack, &value);
}
push(temp_stack, from_setupword);
}
}
}
}
delete_Stack(&temp_stack);
if (parenth_counter > 0) {
writeline("Extra close parenthesis found!");
if (parenth_counter > 0) {
writeline("Extra close parenthesis found!");
newline();
return 0;
}
if (parenth_counter < 0) {
parenth_counter *= -1; // Converts counter to pos num
decout(parenth_counter);
writeline(" unmatched open parenthesis found!");
newline();
return 0;
}
return 1;
}