Your output looks fine. It's the input where you're going wrong.
Trying to parse "1a 777" as integers, it will get "1" then nothing ("a" doesn't parse as an integer).
You want something along the lines of
cin >> hex >> hexin;
cin >> oct >> octin;
Sorry I don't have C++ to hand but that should get you pointed in the right direction.
oops got arrows wrong.