C++ cleaner optimised code, Calculator This code currently works i wonder if i could make any optimisations or anything to make the code appear cleaner using functions or whatnot, suggestions are welcome!

#include &lt;cmath&gt;
#include &lt;cstdio&gt;

int prompt(const char* name) 
{
printf("%s", name);
int value;
scanf("%d", &amp;value);
return value;
}

int main()
{   
    int mod, a, b, zbroj, razlika, umnozak, kolicnik;
    printf("Mod 1 je za zbrajanje \n");
    printf("Mod 2 je za oduzimanje \n");
    printf("Mod 3 je za mnozenje \n");
    printf("Mod 4 je za dijeljenje \n");
    printf("U kojem modu zelis biti: \n");
    std::scanf("%d", &amp;mod);

    switch (mod)
    {
        case 1:
            printf("Odabrali ste zbrajanje! \n");
            a = prompt("a: ");
            b = prompt("b: ");
            zbroj = a + b;
            printf("%d + %d = %d", a, b, zbroj);
            break;
        case 2: 
            printf("Odabrali ste oduzimanje! \n");
            a = prompt("a: ");
            b = prompt("b: ");
            razlika = a - b;
            printf("%d - %d = %d", a, b, razlika);
            break;
        case 3: 
            printf("Odabrali ste mnozennje! \n");
            a = prompt("a: ");
            b = prompt("b: ");
            if(a == 0 or b==0){
                printf("Mnozite s nulom, a kad se mnozi s nulom rezultat je uvijek 0: \n");
                umnozak = 0;
            }
            else
            {
                umnozak = a * b;
            }
            printf("%d * %d = %d", a, b, umnozak);
            break;
        case 4: 
            printf("Odabrali ste dijeljenje! \n");
            a = prompt("a: ");
            b = prompt("b: ");
            if(a == 0 or b==0){
                printf("Dijelite s nulom, a kad se dijeli s nulom rezultat je uvijek 0: \n");
                kolicnik = 0;
            }
            else
            {
                kolicnik = a / b;
            }
            printf("%d / %d = %d", a, b, kolicnik);
            break;
        default:
            printf("Nemamo tu opciju trenutno, prcekajte za nadogradnju programa, ili se javite developeru! \n");
    }
    return 0;
}
Here are some things that may help you improve your code.

Check return values for errors

The call scanf can fail.  You must check the return values to make sure it hasn't or your program may crash (or worse) when given malformed input or due to low system resources.  Rigorous error handling is the difference between mostly working versus bug-free software.  You should strive for the latter.

Decompose your program into functions

Almost all of the logic here is in main in one rather long and dense chunk of code.  It would be better to decompose this into separate functions.

Don't abuse using namespace std

Putting using namespace std at the top of every program is a bad habit that you'd do well to avoid.  Know when to use it and when not to (as when writing include headers).  In this particular case, I happen to think it's perfectly appropriate because it's a single short program that and not a header. Some people seem to think it should never be used under any circumstance, but my view is that it can be used as long as it is done responsibly and with full knowledge of the consequences.  

Use &lt;cstdio&gt; instead of &lt;stdio.h&gt;

The difference between the two forms is that the former defines things within the std:: namespace versus into the global namespace.  Language lawyers have lots of fun with this, but for daily use I'd recommend using &lt;cstdio&gt;.  See this SO question for details.

Prefer iostream to old-style printf

The iostream library is the more modern C++ way to do I/O.  Prefer it over printf and scanf.  So instead of this:

printf("%d + %d = %d", a, b, zbroj);


Write this: 

std::cout &lt;&lt; a &lt;&lt; " + " &lt;&lt; b &lt;&lt; " = " &lt;&lt; zbroj &lt;&lt; '\n';;


See SL.io.3 for details.

Initialize variables before use

The mod variable is printed before it is set to any value.  That is not likely to be useful.  Better is to always make sure that all variables are initialized before using them.

Use constant string concatenation

This code currently includes these lines:

cout &lt;&lt; "U kojem modu kalkulatora zelis biti? \n" &lt;&lt; mod;
cout &lt;&lt; "Mod 1 je za zbrajanje \n";
cout &lt;&lt; "Mod 2 je za oduzimanje \n";
cout &lt;&lt; "Mod 3 je za mnozenje \n";
cout &lt;&lt; "Mod 4 je za dijeljenje \n";


I would suggest writing it instead like this:

std::cout &lt;&lt; 
    "U kojem modu kalkulatora zelis biti? \n" 
    "Mod 1 je za zbrajanje \n"
    "Mod 2 je za oduzimanje \n"
    "Mod 3 je za mnozenje \n"
    "Mod 4 je za dijeljenje \n";


Since the next line happens to be scanf, I'd suggest instead using your prompt function.

Consider using more idiomatic C++

While your use of and and not is not techncially wrong, you should be aware that many experienced C++ programmers will be unfamiliar with these operator alternatives, and so if others read your code, it might be an impediment to their understanding of the code.  

Eliminate redundant variables

I don't speak Croatian, but the variable names are good in that they accurately describe what the variables mean in the context of the program.  However, I would suggest that instead of zbroj, razlika, umnozak, kolicnik you could use a single variable rezultat.

Don't Repeat Yourself (DRY)

The mathematical operations in the case statement all include very similar repeated code.  Instead of repeating code, it's generally better to make common code into a function.  The only thing that varies is the prompt, the mathematical operation and the way the result is printed.  An advanced technique would be to gther them all into a data structure.  If you're just beginning, don't worry if you can't understand this yet.  It uses lambda expressions and C++17 std::string_view among other things.  I am putting it here to show how powerful C++ can be:

#include &lt;cmath&gt;
#include &lt;iostream&gt;
#include &lt;string_view&gt;
#include &lt;array&gt;

int prompt(const char* name) 
{
    std::cout &lt;&lt; name;
    int value;
    std::cin &gt;&gt; value;
    return value;
}

int main()
{   

    struct MathOp {
        std::string_view opname;
        int (*operate)(int a, int b);
        std::string_view opsymbol;

        void operator()() const {
            std::cout &lt;&lt; "Odabrali ste " &lt;&lt; opname &lt;&lt; "!\n";
            int a = prompt("a: ");
            int b = prompt("b: ");
            int rezultat = operate(a, b);
            std::cout &lt;&lt; a &lt;&lt; opsymbol &lt;&lt; b &lt;&lt; " = " &lt;&lt; rezultat &lt;&lt; '\n';
        }

    };

    constexpr std::array&lt;MathOp, 4&gt; op{{
        { "zbrajanje", [](int a, int b){ return a+b; }, " + " },
        { "oduzimanje", [](int a, int b){ return a-b; }, " - " },
        { "mnozenje", [](int a, int b){ return a*b; }, " * " },
        { "dijeljenje", [](int a, int b){ 
                if (b == 0) {         
                    std::cout &lt;&lt; "dijeljenje s nulom \n";
                    return 0;
                } 
                return a/b;
            }, " / " },
    }};

    std::cout &lt;&lt; "U kojem modu kalkulatora zelis biti? \n";
    for (std::size_t i{0}; i &lt; op.size(); ++i) {
        std::cout &lt;&lt; "Mod " &lt;&lt; i+1 &lt;&lt; " je za " &lt;&lt; op[i].opname &lt;&lt; "\n";
    }
    unsigned mod;
    std::cin &gt;&gt; mod;

    if (mod &gt; 0 &amp;&amp; mod &lt;= op.size()) {
        op[mod-1]();
    } else {
        std::cout &lt;&lt; "Nemamo tu opciju trenutno, prcekajte za nadogradnju programa, ili se javite developeru! \n";
    }
}


Now if we want to add exponentiation, for example, all we need to do is add a single line to the op array:

{ "eksponenciju", [](int a, int b){ return static_cast&lt;int&gt;(std::pow(a,b)); }, " ** " },