A switch will connect all the computers to each other but it won't be able to serve the internet to all the computers. You need a router for that. The router will remember what computer requested what from the internet and transport the packets to the IP address of the various computers making the specific internet request. A switch alone cannot perform that task. Google DHCP to learn more about the internal function of routers.