random dice roll help

#include <iostream>
#include <ctime>
#include <iomanip>
using namespace std;
int main()
{
srand((unsigned)time(NULL));
int die1, die2, total;



cout << "First die is a" << setw(5) << die1 << endl;
cout << "Second die is a" << setw(4) << die2 << endl;
cout << "The total is" << setw(8) << total << endl;


system("pause");
return 0;


}


This is the code I currently have. I'm stuck on how to get the dice to actually roll randomly with the time. Any help is appreciated. My portfolio is due tomorrow. Thanks in advance.
Looks like you want to use the rand() function.

http://www.cplusplus.com/reference/cstdlib/rand/
I believe I've figured it out using
int die1 = rand() % 6 +1;
int die2 = rand() % 6 +1;
int total = die1 + die2;

and aligning total to setw(7).
Thank you Peter87!
Topic archived. No new replies allowed.