1 set up stack in and print it
2 while stack in is not empty repeat
2.1 max = in.pop
2.2 while there are still element in stack in repeat
2.2.1 value = in.pop
2.2.2 if value > max
2.2.2.1 temp.push(max)
2.2.2.2 max = value
2.2.3 else
2.2.3.1 temp.push(value)
2.3 in = temp
2.4 out.push(max)
2.5 temp.clear
3 print sorted stack
Please use the code format tags to format your code, it's impossible to read it without formatting.
The big mistake is when in the outer while loop where you set max, you don't pop the stack.
You do see temp stack needs to be cleared, but it's a bit tricky to do so. A principle that's introduced in C++ is to declare variables where used. Now, you've declared temp at the top of the program, but it isn't used there, it's used in the outer loop, so move the declaration there. When the outer loop ends, it cleans up temp and so does the clear for you.
I hope that helps. That was an excellent initial attempt.