Undefined reference to `std::cout'

Put following two lines on the top of your code.

#include < iostream >
using namespace std;