All pastes #728296 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-10-06 21:19 UTC
rendered paste body
#include <iostream>
#include <iomanip>
#include <ctime> 
#include <cstdlib>
using namespace std;
int main()
{
    int rolls, one, two, three, four, five, six = 0;
    cout << "Enter the amount of dice rolls desired: ";
    cin >> rolls;
    srand((unsigned)time(0));
    for(int i=0; i<rolls; i++)
    { 
        int random = (rand()%6)+1;
        if (random == 1)
        one++;
        if (random == 2)
        two++;
        if (random == 3)
        three++;
        if (random == 4)
        four++;
        if (random == 5)
        five++;
        if (random == 6)
        six++;
        cout << random << endl;
    }
    cout << "Value " << setw(20) << "Number of Occurences" << setw(20) << "Percent Occurence" << endl;
    cout << "1" << setw(20) << one << setw(20) << one/rolls << "%";
    cin.get();
    cin.get();
}