Console calculator, takes a string as input (like: 2+3*4-1+3) and outputs the result I am a beginner programmer(solo learning). I know the basics of c/c++, but I would not consider myself too experienced. Recently I decided to make this calculator which takes an array of characters as input and then decodes the operations. I would like to know if I can improve it in any way and an overall review.

#include &lt;iostream&gt;
#include &lt;string.h&gt;
#include &lt;stdio.h&gt;
using namespace std;

int main()
{
    char v[20];
    int sign, n, i;
    float result, nr, aux, c;
    while (1)
    {
        cout &lt;&lt; "insert the expression:" &lt;&lt; endl;
        scanf("%s", v);
        n = strlen(v);
        result = 0, nr = 0, aux = 0, c = 0;
        sign = 1, n, i = 0;
        while (i&lt;n)//loops only once through the array
        {
            while (v[i] &gt;= '0'&amp;&amp;v[i] &lt;= '9')//builds the number
            {
                nr = nr * 10 + (v[i] - '0');
                i++;
            }
            switch (v[i])//identifies the operations
            {
            case '+': {

                if (!(v[i - 1] == '*') &amp;&amp; !(v[i - 1] == '/'))//if a*-b or a/-b occurs it does nothing
                {
                    if (c == 1)// * was found before: 2*2+1
                    {
                        result += aux*nr*sign;// updates the end result
                        aux = 0;//aux is reseted
                    }
                    else if (c == 2)// / was found before: 2/2+1
                    {
                        result += aux / nr*sign;
                        aux = 0;
                    }
                    else
                    {
                        result += nr*sign;
                    }
                    nr = 0;
                    c = 0;
                }

                sign = 1;

                break;
            }
            case '-': {
                if (!(v[i - 1] == '*') &amp;&amp; !(v[i - 1] == '/'))
                {
                    if (c == 1)
                    {
                        result += aux*nr*sign;
                        aux = 0;
                    }
                    else if (c == 2)
                    {
                        result += aux / nr*sign;
                        aux = 0;
                    }
                    else
                    {
                        result += nr*sign;
                    }
                    c = 0;
                    nr = 0;
                }
                sign = -1;
                break;
            }
            case '*': {
                if (!aux)
                {
                    aux = nr*sign; // aux hold the result from * and / operations
                }
                else if (c == 2)
                {
                    aux /= nr*sign;
                }
                else
                {
                    aux *= nr*sign;
                }
                c = 1;
                nr = 0;
                sign = 1;
                break;
            }
            case '/': {
                if (!aux)
                {
                    aux = nr * sign;
                }
                else if (c == 1)
                {
                    aux *= nr*sign;
                }
                else
                {
                    aux /= nr*sign;
                }
                c = 2;
                nr = 0;
                sign = 1;
                break;
            }
            default:;
            }
            if (i &gt;= (n - 1))// updates the result because there is no + or - at the end of the string.
            {
                if (c == 1)
                {
                    result += aux*nr*sign;
                }
                else if (c == 2)
                {
                    result += aux / nr*sign;
                }
                else
                {
                    result += nr*sign;
                }
            }
            i++;
        }
        cout &lt;&lt; "=" &lt;&lt; result &lt;&lt; endl;
        system("pause");
        system("cls");

    }

}
Some quick observations:


Don't use using namespace std 
Prefer using \n over std::endl
Prefer prefix over postfix
You're mixing C and C++ here. Use &lt;cstring&gt;/&lt;string&gt; (depending on what you need) instead of string.h. For input have a look at the C++ I/O library
Some of your code is windows only ( system("pause") and system("cls") )
Don't define more than one variable per line
Comparing floats with ==/!= might be unsafe
There are several (probably unwanted) type conversions which you can catch by enabling warnings in your compiler of choice
Putting all the code into the main function makes this hard to read. It's better to split it up into functions
Try to avoid overly short variable names. They should always express intent to make reading the code easier.