Optimizing simple prime number function test
You have both &lt;cmath&gt; and &lt;math.h&gt;, but you only need the former.  The latter is a C library.
You can have main() at the bottom, allowing you to eliminate the function prototype.
Do not use single-character variable names (except for simple loop counters, which can be simple).  They are hard to understand for others, and may even leave you confused in the future, especially if you expand on the program quite a bit.

As such, X should be renamed to something like number.
PrimeTest() should return bool, not int.  Returning an int is more common in C, but is not done in C++ (it's only done in main(), but it is special).  You'll then return either true or false and compare them as such.  This will also eliminate the need for Answer.
The final output can be simplified to a single-line ternary (?:) statement:

std::cout &lt;&lt; X &lt;&lt; " is " &lt;&lt; ((PrimeTest(X)) ? "prime" : "NOT prime");


This is essentially a shorter way of writing an if/else statement, but is best done with simple cases such as this one.  If you'll ever need to expand on these conditions, then it would be better to go back to using curly braces.