mardi 1 septembre 2020

How to select specific numbers within an Array to Randomize? C++

I have a dice assignment to code, and basically there are 6 dices that we roll. Once it's rolled, all values (other than a single 1 or 5) can be rolled again .

How do I create an input, which can then be used to select the nth element of an array to be randomized again? Thanks

    cout << "All dices you've rolled are scoring dices!\n";
        cout << "Do you wanto to [q]uit, [r]oll or [s]score";
        cin >> question; 

        if (question == 'q') {
            system("pause");
            exit();
        }
        else if (question == 'r') {
            cout << "Which dice(s) do you want to set aside? \n";
            cout << "(1-6) Enter which dice(s) without any spaces";
            cin >> choice;  
            for (int i : choice) {
               /* This is the place where I enter the code to be able to randomize the nth element of an array with another function */
            }
        }
    }
}



Aucun commentaire:

Enregistrer un commentaire