You should be able to just do yum install gcc-c++ if the repos are set up. Give that a try first (you can see what repos are installed with yum repolist).
How to install GCC/G++ 8 on CentOS - Stack Overflow
software installation - Install GCC 4.8+ on rhel x86_64 workstation 6 - Unix & Linux Stack Exchange
Unable to install openmpi on RedHat 8.6 system
Serious vulnerability fixed with OpenSSH 9.8
Ok, the repository has nothing to do with the workstation sub-channel, it's called rhel-6-desktop-optional-rpms. After I enabled that in the /etc/yum.repos.d/redhat.repo, yum found the gcc-c++ package.
How about installing it from your DVD?
For my RHEL 6.4, the RPM file can be found under the folder X:\Packages.
CentOS 8 already comes with GCC 8.
On CentOS 7, you can install GCC 8 from Developer Toolset. First you need to enable the Software Collections repository:
yum install centos-release-scl
Then you can install GCC 8 and its C++ compiler:
yum install devtoolset-8-gcc devtoolset-8-gcc-c++
To switch to a shell which defaults gcc and g++ to this GCC version, use:
scl enable devtoolset-8 -- bash
You need to wrap all commands under the scl call, so that the process environment changes performed by this command affect all subshells. For example, you could use the scl command to invoke a shell script that performs the required actions.
Permanently adding DTS to your development environment
After installing the devtoolset:
yum install devtoolset-8-gcc devtoolset-8-gcc-c++
You can also use the following command, to make DTS the default:
source scl_source enable devtoolset-8
The benefit of this command is that it can be added to .bashrc, so that you don't have to run the scl command every time you login:
scl enable devtoolset-8 -- bash