Python is installed by the operating system, but C and C++ compilation tools are installed via the OS X Command Line tools, which can operate independent of Xcode. You download these from here, once you have signed up for a free developer account using your Apple ID and password.
The compiler you will be using is Clang and Clang++. Expect strong type checking, so if you are learning from a K & R book, you are in for a surprise.
A typical C++ compilation line depending on the degree of C++11 and regular C++ that you use. The following program imports iostream, locale, and map protocol because I wanted to simulate key/value pairs. This was compiled on OS X 10.10.4.
clang++ -Wall -O2 -o fib_memo fib_memo.C -std=c++11 -stdlib=libc++
Resist any temptation to modify the current Python installation in OS X, because if you screw it up, you will have to reinstall Yosemite to get it back to original. If your classwork calls for a Python 3 interpreter, then use the homebrew package manager to install the latest. It won't step on your system Python.