주사위모의실험
본 자료는 3페이지 의 미리보기를 제공합니다. 이미지를 클릭하여 주세요.
닫기
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
해당 자료는 3페이지 까지만 미리보기를 제공합니다.
3페이지 이후부터 다운로드 후 확인할 수 있습니다.

소개글

주사위모의실험에 대한 보고서 자료입니다.

목차

-윈도우즈 환경으로 개발할 것
즉, 모의실험시 1회에 던질 회수와
모의실험 반복회수를 입력 TextBox로 입력받아,
버튼을 클릭할 경우 실험한 후 그 평균 결과를
텍스트 박스에 출력할 것

C#입니다 윈도우즈환경에서 개발한것.

본문내용

his.four.TabIndex = 9;
this.four.Text = "";
//
// five
//
this.five.Location = new System.Drawing.Point(248, 232);
this.five.Name = "five";
this.five.ReadOnly = true
this.five.Size = new System.Drawing.Size(103, 21);
this.five.TabIndex = 9;
this.five.Text = "";
//
// six
//
this.six.Location = new System.Drawing.Point(248, 264);
this.six.Name = "six";
this.six.ReadOnly = true
this.six.Size = new System.Drawing.Size(103, 21);
this.six.TabIndex = 9;
this.six.Text = "";
//
// play
//
this.play.Location = new System.Drawing.Point(112, 320);
this.play.Name = "play";
this.play.Size = new System.Drawing.Size(104, 48);
this.play.TabIndex = 10;
this.play.Text = "모의실험 반복실험";
this.play.Click += new System.EventHandler(this.play_Click);
this.play.Enter += new System.EventHandler(this.play_Click);
//
// exit
//
this.exit.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.exit.Location = new System.Drawing.Point(240, 328);
this.exit.Name = "exit";
this.exit.Size = new System.Drawing.Size(104, 40);
this.exit.TabIndex = 11;
this.exit.Text = "Exit";
this.exit.Click += new System.EventHandler(this.exit_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.CancelButton = this.exit;
this.ClientSize = new System.Drawing.Size(488, 390);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.exit,
this.play,
this.one,
this.label8,
this.label7,
this.label6,
this.label5,
this.label4,
this.label3,
this.number,
this.label2,
this.label1,
this.repeat,
this.two,
this.three,
this.four,
this.five,
this.six});
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///

[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void exit_Click(object sender, System.EventArgs e)
{
DialogResult result=MessageBox.Show("프로그램을 종료하겠습니까?","프로그램 종료",MessageBoxButtons.YesNo);
if(result==DialogResult.Yes)
Application.Exit();
}
private void play_Click(object sender, System.EventArgs e)
{
int num=int.Parse(number.Text); //number에서 받은 문자형을 int형으로 바꿔저장
int rep=int.Parse(repeat.Text); //repeat에서 받은 문자형을 int형으로 바꿔저장
int rpt=rep;
int []freq_ex=new int[7];
int []freq=new int[7]; //주사위면 배열 생성freg
Random r=new Random(); //랜덤 클래스 호출
int face;
for(;rep>0;rep--) //rep가 0보다 클때까지만 하나씩줄여가며 반복한다
{
for (int j=0;j {
face=r.Next(6)+1;
freq[face]++; //각 주사위면에 저장
}
}
for(int i=1;i<7;i++)
{
freq[i]=freq[i]/rpt; //각 나온면에 평균을 낸다
}
one.Text = freq[1].ToString();
two.Text = freq[2].ToString();
three.Text=freq[3].ToString();
four.Text= freq[4].ToString();
five.Text= freq[5].ToString();
six.Text = freq[6].ToString();//각 주사위면 출현 텍스트에 정수형을 문자형으로 바꿔 입력
}
private void Form1_Load(object sender, System.EventArgs e)
{
}
private void number_TextChanged(object sender, System.EventArgs e)
{
}
private void label1_Click(object sender, System.EventArgs e)
{
}
}
}
<결과값>

키워드

윈도우폼,   C,   c,   주사위,   소스,   c#
  • 가격1,000
  • 페이지수10페이지
  • 등록일2003.08.05
  • 저작시기2003.08
  • 파일형식한글(hwp)
  • 자료번호#224691
본 자료는 최근 2주간 다운받은 회원이 없습니다.
청소해
다운로드 장바구니