#include <iostream> and implement defix function

Couldn't run the file, so I have no idea whether my implementation is
right or not.