import java.applet.*;
import java.awt.*;
public class Test1 extends Applet
{
private int onecnt=0;
private int twocnt=0;
private int threecnt=0;
private int fourcnt=0;
private int fivecnt=0;
private int sixcnt=0;
public void paint(Graphics g)
{
int a[] = new int[100];
int count[] =new int[7];
for(int i=0;i< 100;i++)
{
a[i]= (int)(Math.random()*6+1);
count[a[i]]++;
System.out.print(a[i] + " ");
switch(a[i])
{
case 1:onecnt++;break;
case 2:twocnt++;break;
case 3:threecnt++;break;
case 4:fourcnt++;break;
case 5:fivecnt++;break;
case 6:sixcnt++;break;
}
。。。。
2021-12-30 19:32:40
2KB
柱状图
1