Simple Brute Force implementation in C++