Installing gcc-7 (and newer packages) in Ubuntu 16.04 [closed]

You can already install gcc-7 and g++-7 from this package.

sudo add-apt-repository ppa:jonathonf/gcc-7.1
sudo apt-get update
sudo apt-get install gcc-7 g++-7

Type:

sudo sed -i 's/xenial/zesty/g' /etc/apt/sources.list.d/ubuntu-toolchain-r*.list
sudo apt update && sudo apt full-upgrade

And you will have installed gcc gcc-7 cpp cpp-7 g++ g++-7 and few additional dependencies packages in your current Ubuntu release (not older 16.04).