mercredi 25 février 2015

random dice generator C++

How can i modify my program so it has a single parameter representing the number of dice to be rolled instead of automatically rolling two dice? This is my code so far.



#include <cstdlib>
#include <iostream>

using namespace std;

int dice_score()
{

srand(time(NULL));
int roll1 = rand() % 6 + 1;
int roll2 = rand() % 6 + 1;
return roll1;
return roll2;

}




Aucun commentaire:

Enregistrer un commentaire