BigInteger class, supporting addition only Here is just addition, no multiplication or subtraction, but I will implement them later. Before going on, I'm here to ask for advice about the design.

#pragma once
#include &lt;stdlib.h&gt;
#include &lt;crtdbg.h&gt;
#include "stdafx.h"
#include &lt;string&gt;
#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;cassert&gt;
#include &lt;algorithm&gt;
#define to_int(x) (x - '0')
#define to_char(x) (char)(x + '0')
struct InvalidBigInt {};
class BigInteger
{
private:
    std::vector&lt;char&gt; vnum;
    std::string snum;
public:
    static bool flag;
    BigInteger() = default;
    BigInteger(const std::vector&lt;char&gt;&amp; v) : vnum(v) {}
    BigInteger(std::string&amp;&amp; str) : snum(str)
    {
        vnum.clear();
        vnum = { str.crbegin(), str.crend() };
        try
        {
            if (std::find_if(str.begin(), str.end(),
                [](char c) { return !(isdigit(c)); }) != str.end())
            {
                throw InvalidBigInt();
            }
        }
        catch (InvalidBigInt)
        {
            std::cout &lt;&lt; "*****************      Input invalid integer      *****************" &lt;&lt; std::endl &lt;&lt; \
                "*****************      Please input again         *****************" &lt;&lt; std::endl;
        }
        flag = true;
    }
    friend std::ostream&amp; operator&lt;&lt;(std::ostream&amp; out, BigInteger bi)
    {
        std::for_each(bi.vnum.rbegin(), bi.vnum.rend(), [&amp;](char c) {out &lt;&lt; c; });
        return out;
    }
    BigInteger operator+(BigInteger b)
    {
        std::string result;
        auto more = b.vnum.size() &gt;= this-&gt;vnum.size() ? b.vnum : this-&gt;vnum, less = b.vnum.size() &lt; this-&gt;vnum.size() ? b.vnum : this-&gt;vnum;
        int temp = 0, digit = 0, diff = more.size() - less.size();
        for (size_t i = 0; i &lt; diff; i++) { less.push_back('0'); }
        for (auto IteratorMore = more.begin(), IteratorLess = less.begin();
            IteratorMore &lt; more.end() &amp;&amp; IteratorLess &lt; less.end();
            IteratorMore++, IteratorLess++)
        {
            digit = to_int(*IteratorMore) + to_int(*IteratorLess) + temp;
            if (digit &gt; 9) { temp = 1; digit -= 10; }
            else { temp = 0; }
            result = to_char(digit) + result;
        }
        if (temp) { result = to_char(temp) + result; }
        return BigInteger(std::move(result));
    }
    bool operator==(BigInteger b)
    {
        return this-&gt;vnum == b.vnum;
    }
    ~BigInteger() noexcept {}
};
bool BigInteger::flag{ false };

int main()
{
    /*********************************PLUS*******************************/
    {
        assert(BigInteger("0") + BigInteger("0") == BigInteger("0"));
        assert(BigInteger("0") + BigInteger("1") == BigInteger("1"));
        assert(BigInteger("1023") + BigInteger("1") == BigInteger("1024"));
        assert(BigInteger("987") + BigInteger("34") == BigInteger("1021"));
        assert(BigInteger("98765") + BigInteger("23456") == BigInteger("122221"));
        assert(BigInteger("9230842083418927893758317489127418924781923748912") + BigInteger("81923743214617823686412783461237846178463")
            == BigInteger("9230842165342671108376141175540202386019769927375"));
    }
}
Abusing the use of macros

I think there is no good reason for implementing to_int() and to_char() as macros - such an implementation may result in hard to find bugs as you don't have any type checking. Lack of parameter types also makes it harder to understand what the function is expected to do in case of more complex functions.

Also, the names of these functions are misleading as they don't inform in a clear way that you are expecting an input to represent a single digit and any other input is invalid.

If you stick to the macro anyway, it's a common convention to use uppercase letters for macro names - most people would expect an ordinary function after seeing lowercase to_int()/to_char().

Single responsibility principle violation

Using catch this way:

catch (InvalidBigInt)
        {
            std::cout &lt;&lt; "*****************      Input invalid integer      *****************" &lt;&lt; std::endl &lt;&lt; \
                "*****************      Please input again         *****************" &lt;&lt; std::endl;
        }


you are restricting the use of your class to console applications. Things such as text display should be moved outside of your class as the responsibility of your class is to calculate numbers, not display them nor interact with a user via an interface. 

Unclear variable names

Tha name flag is very vague and it's necessary to read the code to see what it's supposed to do (assuming it is used in the intended way). I'm not sure what is its purpose anyway since it's only set and not referred to anywhere in the code. I also suspect it shouldn't be a static variable.

Organizing code into headers and implementation files

Don't put all your code within your main.cpp file. It's more versatile and easier to manage if you separate it and put declarations in headers and definitions in .cpp files - you'll see that as soon as you decide to separate the text display functionality mentioned above from your main class.

Inconsistent and uncommon naming convention

Here:

for (auto IteratorMore = more.begin(), IteratorLess = less.begin();
    IteratorMore &lt; more.end() &amp;&amp; IteratorLess &lt; less.end();
    IteratorMore++, IteratorLess++)


the names of the variables IteratorMore and IteratorLess start with a capital 'I', whereas it is a common practice to start the name of a class with the capital letters and start variable names with a lowercase. You are also following this convention correctly throughout your code, except in this part.

Const correctness

You don't always adhere to the concept of const correctness: your operators don't modify the BigInteger argument and thus it should be passed as a const reference to avoid unnecessary copies and make room for possible compiler optimizations.

Code lines' length

In some places in your code, you are writing very long lines, such as:

auto more = b.vnum.size() &gt;= this-&gt;vnum.size() ? b.vnum : this-&gt;vnum, less = b.vnum.size() &lt; this-&gt;vnum.size() ? b.vnum : this-&gt;vnum;


Even though most modern IDE's have built-in line wrapping, it's a good practice to write your code in such a way that a single line comprises approximately 80 characters. It's more comfortable and faster to read and comprehend the code if you are not forced to scroll it or move your eyeballs repeatedly from one side of a wide screen to another. Also that way you have control over where you wrap your code, whereas line wrapper functionality may visually organize the code in a way that makes it less readable. Also it's easier to use diff tools and open several editor windows side-by-side if you stick to this rule. See the discussion e.g. here:

https://stackoverflow.com/questions/276022/line-width-formatting-standard

Redundant variables

It seems you are not using snum anywhere in your code right now and even if you do use it in the future, it is probably to serve exactly the same puropse
as vnum, so it's better to convert one type to another instead of keeping both and using only one of them depending on what's passed to the constructor - right now you would have to double your code by checking which variable is set inside each of your functions.

I would ditch vnum and use snum everywhere instead as std::string is a semantic equivalent of std::vector&lt;char&gt;, except you can benefit from small string optimization.