Wikipedia's page on the http://en.wikipedia.org/wiki/Carnot_cycle" [Broken] does a good job of explaining what is occurring in terms of heat flow and work.
In the higher temperature isothermal part, heat flows into the system. Since it is isothermal, there is no change in U so [itex]\Delta Q = W[/itex] (expansion-positive work done by the system). In the cooler isothermal part heat flows out of the system with no change in U so work must be done on the system (compression). Of course in the adiabatic parts there is no heat flow so the work done + the change in internal energy = 0: [itex]\Delta U = -W[/itex].