// july28ex2.cpp : Defines the entry point for the console application.
//  This program throws a pair of dice and counts the number of times each total comes up.

#include "stdafx.h"
#include "stdlib.h"
#include "time.h"


int main(int argc, char* argv[])
{
	int score[13];   /* allows sub 0 < - > 12  */

    int throws, total, pos, max, min;

	srand(time(NULL));


	for (total=2; total<=12; total++)
		score[total] = 0;
	
	for (throws=1; throws <= 100; throws++) {

           total= (rand() % 6 + 1) + (rand() % 6 +1);  
		   score[total] = score[total] + 1;


	} /*end for throws */

    for (total=2; total <= 12; total++)
		printf("Score %2d was found %d times\n", total, score[total]);


	max = -1;
    for (total=2; total <= 12; total++)
		if ( score[total] > max)
			max=score[total];

    printf("The max count of %d was found at position (s) ", max);

	for (pos=2; pos<=12; pos++)
		if (score[pos] == max)
			printf("%d ", pos);
	printf(".\n");


	min = score[2];
    for (total=3; total <= 12; total++)
		if ( score[total] < min)
			min=score[total];

    printf("The min count of %d was found at position (s) ", min);

	for (pos=2; pos<=12; pos++)
		if (score[pos] == min)
			printf("%d ", pos);
	printf(".\n");


	return 0;
}