First calculator in c++, tips for optimisation So this is my first attempt at making a calculator in c++, and i'm looking for experienced people to pinpoint what i could do better to make my calculator run better! *please note that i had to translate some parts of the code to english from my native language, and had to change bunch of names so if i forgot something somewhere my bad :P

#include &lt;cmath&gt;
#include &lt;iostream&gt;
#include &lt;stdio.h&gt;

using namespace std;

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

int main()
{   
    int mod;
    cout &lt;&lt; "U kojem modu kalkulatora zelis biti? " &lt;&lt; mod &lt;&lt; endl;
    cout &lt;&lt; "Mod 1 je za zbrajanje" &lt;&lt; endl;
    cout &lt;&lt; "Mod 2 je za oduzimanje" &lt;&lt; endl;
    cout &lt;&lt; "Mod 3 je za mnozenje" &lt;&lt; endl;
    cout &lt;&lt; "Mod 4 je za dijeljenje" &lt;&lt; endl;
    cin &gt;&gt; mod;

    switch (mod)
    {
        case 1:
            cout &lt;&lt; "Odabrali ste zbrajanje!" &lt;&lt; endl; 
            int a, b, zbroj;
            a = prompt("a: ");
            b = prompt("b: ");
            zbroj = a + b;
            printf("%d + %d = %d", a, b, zbroj);
            break;
        case 2: 
            cout &lt;&lt; "Odabrali ste oduzimanje!" &lt;&lt; endl; 
            int razlika;
            a = prompt("a: ");
            b = prompt("b: ");
            razlika = a - b;
            printf("%d - %d = %d", a, b, razlika);
            break;
        case 3: 
            cout &lt;&lt; "Odabrali ste mnozenje!" &lt;&lt; endl; 
            int umnozak;
            a = prompt("a: ");
            b = prompt("b: ");
            umnozak = a * b;
            printf("%d * %d = %d", a, b, umnozak);
            break;
        case 4: 
            cout &lt;&lt; "Odabrali ste dijeljenje!" &lt;&lt; endl;
            int kolicnik;
            a = prompt("a: ");
            b = prompt("b: ");
            kolicnik = a / b;
            printf("%d / %d = %d", a, b, kolicnik);
            break;

        default:
            cout &lt;&lt; "Nemamo tu opciju trenutno, prcekajte za nadogradnju programa, ili se javite developeru!" &lt;&lt; endl;
    }
    return 0;
}


I'm a newbie :P
You should avoid using namespace std.

The code in the prompt function is not indented.

You should avoid using endl unless absolutely necessary (use a \n instead).  endl will flush the output buffer which can be a big performance hit.

You don't have a break statement for the default case of your switch statement.  While not required here, it can lead to problems in the future if additional cases are added after the default and the break is not added.

Declaring uninitialized variables within a switch statement is legal, but can lead to confusion.  Usually when variables are declared under a case, the code of the case is enclosed within { curly brackets }.  For example, the a and b variables, which are used in most of the cases, could be declared before the switch.