Multiple gcc version in Ubuntu

I have install gcc, g++ 11 default by ubuntu 22.04,I want test build in gcc, g++ 10. So I need to install gcc, g++ 10 and switch them.