| Bar graph type thing 
 
	 
	
		| Author | Message |   
		| Thuged_Out_G 
 
 
 
 
 | 
			
				|  Posted: Thu Dec 02, 2004 10:56 pm    Post subject: Bar graph type thing |  |   
				| 
 |  
				| 	  | code: |  	  | 
var dice : array 1 .. 25 of int
 var count : array 1 .. 25 of int
 
 for i : 1 .. 25
 dice (i) := Rand.Int (1, 6)
 end for
 
 for i : 1 .. 25
 count (i) := 0
 end for
 
 for i : 1 .. 25
 if dice (i) = 1 then
 count (1) += 1
 put "Rolled a 1 "
 elsif dice (i) = 2 then
 count (2) += 1
 put "Rolled a 2"
 elsif dice (i) = 3 then
 count (3) += 1
 put "Rolled a 3"
 elsif dice (i) = 4 then
 count (4) += 1
 put "Rolled a 4"
 elsif dice (i) = 5 then
 count (5) += 1
 put "Rolled a 5"
 elsif dice (i) = 6 then
 count (6) += 1
 put "Rolled a 6"
 end if
 end for
 
 
 for i : 1 .. 6
 put "Number of ", i, "'s rolled: ", count (i), " ", count (i) / 25 * 100, "%"
 end for
 
 
 Draw.Box (200, 150, 300, 190, black)
 Draw.FillBox (200, 150, round (count (1) / 25 * 100 + 200), 190, black)
 
 for i : 2 .. 6
 Draw.FillBox (200 + round (count (i - 1) / 25 * 100 + 200), 150, round (count (i - 1) / 25 * 100 + round (count (i) / 25 * 100 + 200)) , 190, i + 30)
 end for
 
 
 | 
 
 i cant get the bar graph right, im not to good with math ... any help?
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Sponsor Sponsor
 
  
   |  |   
		|  |   
		| zylum 
 
  
 
 
 | 
			
				|  Posted: Thu Dec 02, 2004 11:52 pm    Post subject: (No subject) |  |   
				| 
 |  
				| try this: 
 	  | code: |  	  | 
var dice : array 1 .. 25 of int
 var count : array 1 .. 25 of int
 
 for i : 1 .. 25
 dice (i) := Rand.Int (1, 6)
 end for
 
 for i : 1 .. 25
 count (i) := 0
 end for
 
 for i : 1 .. 25
 if dice (i) = 1 then
 count (1) += 1
 put "Rolled a 1 "
 elsif dice (i) = 2 then
 count (2) += 1
 put "Rolled a 2"
 elsif dice (i) = 3 then
 count (3) += 1
 put "Rolled a 3"
 elsif dice (i) = 4 then
 count (4) += 1
 put "Rolled a 4"
 elsif dice (i) = 5 then
 count (5) += 1
 put "Rolled a 5"
 elsif dice (i) = 6 then
 count (6) += 1
 put "Rolled a 6"
 end if
 end for
 
 
 for i : 1 .. 6
 put "Number of ", i, "'s rolled: ", count (i), " ", count (i) / 25 * 100, "%"
 end for
 
 const width := 10
 const spacing := 5
 const scale := 20
 
 for i : 1 .. 6
 Draw.FillBox (100 + i * width + i * spacing, 150, 100 + i * width + width + i * spacing, 150 + dice (i) * scale, i * 2 + 18)
 end for
 | 
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| computer_killer 
 
 
 
 
 | 
			
				|  Posted: Thu Dec 16, 2004 12:19 pm    Post subject: (No subject) |  |   
				| 
 |  
				| which bar represents what it dosen't specify.  |  
				|  |  |   
		|  |  |  
	  
		|  |   
		|  |  
 |