Project Euler #4 - Finding the largest palindrome that is the product of two three-digit numbers. This is my attempt at the 4th problem on Project Euler:

#include "stdafx.h"
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;iostream&gt;

using namespace std;

int palindromeCheck(int pp) {
    int temp = pp;
    string palindrome = std::to_string(pp);

    auto it1 = palindrome.begin();
    auto it2 = palindrome.end() - 1;

    while (it2 - it1 &gt;= 1) {
        if (*it1 == *it2) {
            ++it1;
            --it2; 
        }
        else {
            return 0;
        }
    }
    return 1;
}

int main()
{
    int highestPalindrome = 0; 
    for (int x = 100; x &lt;= 999; x++) {
        for (int y = 100; y &lt;= 999; y++) {
            int newDigit = x * y;
            int paliCheck = palindromeCheck(newDigit);
            if (paliCheck == 1) {
                if (newDigit &gt; highestPalindrome) {
                    highestPalindrome = newDigit;
                }
            }
        }
    }
    std::cout &lt;&lt; highestPalindrome; 
}


I'm trying to get better at both C++ and problem-solving so any help/tips are appreciated.
using namespace std; is a bad practice.  You should should spell out either what you are using, or spell out explicitly the std:: when you are using something.  You are doing the latter already with std::to_string and std::cout, just not with string.

Your palindromeCheck function should return a bool, instead of an int with specific integers having certain meanings.

temp is not used.

You are checking both 100 * 101 and 101 * 100.   Multiplication is commutative, so you can cut your work in half by adjusting your inner y loop to only use number from a range which hasn't been checked yet (from x to 999, inclusive).

newDigit is an odd variable name for the product of x * y.

palindromeCheck(newDigit) is an expensive operation.  newDigit &gt; highestPalindrome is a relatively cheap test.  Consider reversing the order of these tests to avoid calling an expensive function when the result will never be used.