Question: how to connect two computers to one monitor with a cable?
Answer: Two HDMI or Displayport sockets is fairly common, but you may also have a monitor with a mix of VGA, DVI and HDMI. It all depends on its age and model. In order to switch between the two different computers with one monitor, you need to access the internal menu of the monitor and change the input.