Answer:
You can train for all three events by doing related indoor exercises:
Running ⇒ Treadmill
You can use a treadmill to imitate the running aspect of the triathlon. You could even adjust the slope on the treadmill to cater for mountainous areas.
Swimming ⇒ Indoor Swimming
Indoor pools are fast becoming the standard for gyms so you could go to a gym and swim in one of these. Time yourself and go long distances to get the required experience and stamina.
Cycling ⇒ Cycling Machine or Indoor Cycling
For cycling you have the option of either a cycling machine or an indoor cycling course which is offered by some gyms. Cycling machine can be adjusted in terms of the weight of the pedals to mirror tougher terrain so have that added advantage.