private void fib_Click(object sender, EventArgs e) { int m_createmaxno = Convert.ToInt16(tb_maxcount.Text); int m_createno = Convert.ToInt16(tb_count.Text); if (m_createmaxno >= m_createno && m_createmaxno >= 1 && m_createno >= 1) { int[] dt = new int[m_createno]; int a = 0, b = 1, c = 1, i = 2; dt[0] = 0; dt[1] = 1; while (i < m_createno) { c = a + b; dt[i] = c; a = b; b = c; i++; } if (m_createno <= m_createmaxno && m_createno >= 1) { m_seqlist = new CSeqList <int>(m_createmaxno, dt, m_createno); string str = m_seqlist.MyPrint(); richTextBox1.Text = str; } } else { MessageBox.Show("请检查最大个数或数据个数!"); } }
private void bt_create_Click(object sender, EventArgs e) { int m_createmaxno = Convert.ToInt16(tb_maxcount.Text); int m_createno = Convert.ToInt16(tb_count.Text); if (m_createmaxno >= m_createno && m_createmaxno >= 1 && m_createno >= 1) { int[] dt = new int[m_createno]; Random ran = new Random(); for (int i = 0; i < m_createno; i++) { if (ct_ln.Checked == true) { dt[i] = i + 1; } else { dt[i] = ran.Next(m_createno) + 1; } } if (m_createno <= m_createmaxno && m_createno >= 1) { m_seqlist = new CSeqList <int>(m_createmaxno, dt, m_createno); string str = m_seqlist.MyPrint(); richTextBox1.Text = str; } } else { MessageBox.Show("请检查最大个数或数据个数!"); } }
private void button2_Click(object sender, EventArgs e) { int m_createmaxno = Convert.ToInt16(tb_maxcount.Text); int m_createno = Convert.ToInt16(tb_count.Text); if (m_createmaxno >= m_createno && m_createmaxno >= 1 && m_createno >= 1) { int[] dt = new int[m_createno]; int count = 0; int i = 2; Random ran = new Random(); bool b = true; while (i <= m_createno) { for (int j = 2; j < i / 2; j++) { if (i % j == 0) { b = false; } } if (b) { dt[count] = i; count++; } b = true; i++; } for (int n = 0; n < m_createno; n++) { if (dt[n] == 0) { count = n; break; } else { count = m_createno; } } int[] dt2 = new int[count]; for (int n = 0; n < count; n++) { dt2[n] = dt[n]; } m_seqlist = new CSeqList <int>(m_createmaxno, dt2, count); string str = m_seqlist.MyPrint(); richTextBox1.Text = str; } }
private void button1_Click(object sender, EventArgs e) { int m_createmaxno = Convert.ToInt16(tb_maxcount.Text); int m_createno = Convert.ToInt16(tb_count.Text); if (m_createmaxno >= m_createno && m_createmaxno >= 1 && m_createno >= 1) { int[] dt = new int[m_createno]; int[] dt2 = new int[m_createno]; Random ran = new Random(); int c = 0; bool b = true; for (int i = 1; i <= m_createno; i++) { dt2[i - 1] = i; } for (int i = 1; i <= m_createno; i++) { while (dt[i - 1] == 0) { c = ran.Next(m_createno) + 1; if (dt2[c - 1] != 0) { dt[i - 1] = dt2[c - 1]; dt2[c - 1] = 0; } else { dt[i - 1] = 0; } } } m_seqlist = new CSeqList <int>(m_createmaxno, dt, m_createno); string str = m_seqlist.MyPrint(); richTextBox1.Text = str; } else { MessageBox.Show("请检查最大个数或数据个数!"); } }
private void CSeqList_Form_Load(object sender, EventArgs e) { m_seqlist = new CSeqList <int>(100); }