Binary to decimal (and back) converter in c++ I'm mainly looking for error checking / type safety advice.
main.cpp
#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;cmath&gt;
#include &lt;numeric&gt;

void binaryToDecimal();
void decimalToBinary();

int main()
{
    std::ios::sync_with_stdio(false);

    bool running = true;
    int ans;

    while (running)
    {
        std::cout &lt;&lt; &quot;1. Binary to decimal\n2. Decimal to binary\n3. Quit\n&quot;;
        std::cin &gt;&gt; ans;
            
        std::cout &lt;&lt; '\n';

        switch (ans)
        {
        case 1:
            binaryToDecimal();
            break;

        case 2:
            decimalToBinary();
            break;

        case 3:
            running = false;
            break;

        default:
            break;
        }
    }

    return 0;
}

void binaryToDecimal()
{
    int out = 0;
    std::string in;

    std::cout &lt;&lt; &quot;Input binary number: &quot;;
    std::cin &gt;&gt; in;

    int i = in.size() - 1;
    if (i &gt; 32)
    {
        std::cerr &lt;&lt; &quot;That number is too big!\n\n&quot;;
        return;
    }

    for (int j = 0; i &gt; -1; --i, ++j)
    {
        out += static_cast&lt;int&gt;(std::pow(2, i)) * (in[j] - '0');
    }

    std::cout &lt;&lt; in &lt;&lt; &quot; when converted to decimal is &quot; &lt;&lt; out &lt;&lt; &quot;\n\n&quot;;
}

void decimalToBinary()
{
    std::string out = &quot;&quot;;
    std::string in;
    std::cout &lt;&lt; &quot;Input decimal number: &quot;;
    std::cin &gt;&gt; in;

    if (in.size() &gt; std::to_string(std::numeric_limits&lt;int&gt;::max()).size())
    {
        std::cerr &lt;&lt; &quot;That number is too big!\n\n&quot;;
        return;
    }

    int mod = std::stoi(in);

    while (mod &gt; 0)
    {
        out += (mod % 2) + '0';
        mod /= 2;
    }
    std::reverse(out.begin(), out.end());

    std::cout &lt;&lt; in &lt;&lt; &quot; when converted to binary is &quot; &lt;&lt; out &lt;&lt; &quot;\n\n&quot;;
}
General Observations

I'm mainly looking for error checking / type safety advice.

There doesn't seem to be a lot of error checking on user input and user input is one of the places where error checking is most important. For instance, the code doesn't handle negative numbers but there is not checking for negative input.
The code also doesn't check for lack of input, and there are no error messages when the input is wrong.
Type Safety
Since the program doesn't process negative numbers it might be better to use unsigned or unsigned int for conversion rather than int.
Unnecessary Function Prototypes
If the main() function were placed at the bottom of the file rather than the top of the file, the function prototypes
void binaryToDecimal();
void decimalToBinary();

are not needed.
Magic Numbers
There is a Magic Numbers in the binaryToDecimal() function (32), it might be better to create symbolic constants for them to make the code more readable and easier to maintain. These numbers may be used in many places and being able to change them by editing only one line makes maintenance easier.
Numeric constants in code are sometimes referred to as Magic Numbers, because there is no obvious meaning for them. There is a discussion of this on stackoverflow.
In this case 32 probably refers to word size, but that is an arbitrary number, most computers these days have a 64 bit word size. You could get the actual size of the word by using the sizeof() function and then multiplying it by 8 since sizeof() the number of char in the object and 8 bits is the size of a char, there also might be a word size constant hidden in an include header.
Complexity
While main() is pretty simple now, once you start adding the error checking you need it will get more complex, and it should be broken up into different function.