Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Displaying dice simulation with * instead of count

$
0
0
Hello, I am a 1st year student of a computer solutions degree and part of this is C++. I have the following code to count and display dice throws. The problem is that I need to display it with the spot number count displayed as *'s instead of the number of times it occurred. Thanks Nick

 /*
- 1419288 - Book 2 - Worksheet 5 Question 3
*/

#include <stdlib.h>
#include <stdio.h>
#define THROWS 300
#include <time.h>

int main()

{


	int count[13] = {0};
	int store= 0;
	int i=0;
	int y=0;

	srand(time(NULL));					/* initializes random number function */
	
	for(i=0;i<THROWS;i++)
	{	
	store =rand()%6+1+rand()%6+1;		/* two rand numbers adds them together and stores them */
	count[store]++;
	}
	
	for(y=0;y<13;y++)
	{
	//	printf("%d: %d",  count[y], y);
		printf("%d: )
		printf("\n");
	}
		
	return 0;			
}

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>