Text-based dice rolling game in C++ I have made this small text-based dice rolling game in C++. How could I improve it? Be as picky as you'd like.

#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
#include &lt;ctime&gt;

using namespace std;

void mainGame(int &amp;numDice);

int main()
{   
    srand (time(NULL));

    int gameRunning = true;
    int numDice;

    while (gameRunning == true)
    {
        system("cls");
        cout &lt;&lt; "\n How many dice would you like to use? (1-4)" &lt;&lt; endl;
        cout &lt;&lt; "\n Enter '0' to exit." &lt;&lt; endl;
        cout &lt;&lt; "\n&gt; ";
        cin &gt;&gt; numDice;

        if (numDice == 1 || numDice == 2 || numDice == 3 || numDice == 4) 
        {
            mainGame(numDice);
        }

        else if (numDice == 0)
        {
            return 0;
        }

        else {
            system("cls");
            cout &lt;&lt; "\n That was invalid input!" &lt;&lt; endl;
            cout &lt;&lt; "\n ";
            system("pause");
        }
    }
}

void mainGame(int &amp;numDice)
{
    bool goAgain = true;
    int dice[4];
    int input;

    while (goAgain == true)
    {
        for (int x = 0; x != numDice; x++)
        {
            dice[x] = (rand() % 6) + 1;

            cout &lt;&lt; "\n Dice " &lt;&lt; x + 1 &lt;&lt; " shows a " &lt;&lt; dice[x] &lt;&lt; "!" &lt;&lt; endl;
            cout &lt;&lt; "\n ";
            system("pause");    
        }

        system("cls");
        cout &lt;&lt; "\n Would you like to go again with " &lt;&lt; numDice &lt;&lt; " dice?" &lt;&lt; endl;
        cout &lt;&lt; "\n Enter '1' for yes or '2' for no." &lt;&lt; endl;
        cout &lt;&lt; "\n&gt; ";
        cin &gt;&gt; input;
        switch (input)
        {
            case 1:
                break;

            case 2:
                goAgain = false;
        }
    }
}
using namespace std; is considered a bad practice.



Don't do this:


int gameRunning = true;



If you want to use a boolean variable, use a bool instead of int.



You can use boolean values directly in conditions,
no need to compare them to true / false.
So instead of this:


while (gameRunning == true)



You can write simply:

while (gameRunning)




Still about that while loop earlier,
since gameRunning is initialized to true,
the loop condition will be inevitable true for the first time.
That's kind of a waste to re-evaluate.
In situations like this,
considering rewriting it as a do { ... } while (...) loop.