Let be . Let be an open cover of . The continuity of implies that is open in (this is a theorem) and is an open cover of .

Spoiler:

You want to approach connectedness similarly. Assume that where and are open sets such that and try to derive a contradiction. (Your contradiction will be that is not connected.)