Identify possible pair of factors from a product
Don't using namespace std; - this namespace isn't designed for wholesale import like that.

Import &lt;cstdlib&gt; to declare std::system() - though note that almost any use of this function makes your code highly platform-specific (that just gives a sh: pause: not found error here, for example).

Never ignore the return value from std::system or from streaming with &gt;&gt;.

Error messages should go to std::cerr and end with a newline (and we should return early in the error case, rather than continuing to the while loop).

if ((f1 &amp;&amp; f2) == p) is a highly unconventional way of writing if (p == 0).  Don't make it unnecessarily hard to read.

In the while condition, (f1 &amp;&amp; f2) != p) can only be false when p is 1, so just treat that case separately, before the loop.

Prefer pre-increment (++x) to post-increment (x++) in C++ code when not using the result.  Here, with integers, the compiler can optimize to the same code, but with more complex types, that's not always possible.