This is a short outline of how to install the C++ workload with Visual Studio or the build tools using winget.
To find VS releases with winget use search.
winget search buildtools
The install command will install the VS installer with the core of the selected product installed. That isn't much. So if you use either of these commands to insll VS or the build tools you will need to launch the VS installer afterwards and select the relevant C++ workloads you need.
winget install Microsoft.VisualStudio.2022.BuildTools
winget install Microsoft.VisualStudio.2022.Community