Using a dedicated analog MUX, as stated above, would probably be the best solution. You can, however, build it from discrete components. Following circuit should do the job. Each switch (otherwise known as a transmission gate) consists of two MOSFETs, P- and N-Channel respectively. It is activated by applying VCC to N-FET's gate and by pulling P's gate to GND. Applying voltages in the opposite order will disable the switch. That's what the inverter's doing (it can be realized by two MOSFET's as well).
Note that this is only guaranteed to work when used in the form of an off-the-shelf IC. It may or may not work when bodged together using discrete CMOS
It will function properly - more or less linearly - if the INPUT voltages remain below VCC - Vth, where Vth is the switch-on threshold voltage of the MOSFET's.