We stayed in Cody for 2 or 3 nights last year at Absaroka Bay RV Park, it was nice but a little "tight" but than so were the others we drove past too. It's very well managed. Would I stay there again? Yup I sure would!
There's a bunch of things to do and see just in Cody alone, plenty of good places to eat and of course there are a couple of shops too. :B
Buffalo Bill Museum is great, I'd plan on spending a couple of days going through there as it's pretty awesome! Go to the Irma Hotel for a lunch, another way cool thing to experience. The Old West Trail Town was another experience we enjoyed very much.
As for Yellowstone, it's a fair drive like others have said, it would make for a long day but would be doable. We drove through Yellowstone and stayed in West Yellowstone MT, made that our "base" and went back into Yellowstone from there, it's closer to the park and easy to drive. You'll be doing a LOT of driving in the park!
Dan