实例介绍
【实例简介】
【实例截图】
【核心代码】
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace CPK { public partial class Form1 : Form { float pingjun1, pingjun2, qt1, qt2, qt3, qt4, qt5,shangbianjie,xiabianjie,shangbianjie2; int zx, zd,cs; float a6, b6, c6, d6, e6, f6, g6, h6, i6, j6, k6, l6, m6, n6, o6, p6, q6, r6, s6, t6, u6, v6, w6, x6, y6; private void label5_Click(object sender, EventArgs e) { } private void button2_Click(object sender, EventArgs e) { } float a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1, q1, r1, s1, t1, u1, v1, w1, x1, y1; float a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2, q2, r2, s2, t2, u2, v2, w2, x2, y2; float a3, b3, c3, d3, e3, f3, g3, h3, i3, j3, k3, l3, m3, n3, o3, p3, q3, r3, s3, t3, u3, v3, w3, x3, y3; float a4, b4, c4, d4, e4, f4, g4, h4, i4, j4, k4, l4, m4, n4, o4, p4, q4, r4, s4, t4, u4, v4, w4, x4, y4; float a5, b5, c5, d5, e5, f5, g5, h5, i5, j5, k5, l5, m5, n5, o5, p5, q5, r5, s5, t5, u5, v5, w5, x5, y5; public Form1() { InitializeComponent(); } public static int QiUp(float[] numberszx) { int n = 0; for (int i = 0; i < numberszx.Length-1;i ) { if (numberszx[i] < numberszx[i 1]) { n ; } else { n = 0; } } return n; } public static int QiDown(float[] numberszx) { float lingshi = numberszx[0]; int n = 0; for (int i = 0; i < numberszx.Length-1;i ) { if (numberszx[i] > numberszx[i 1]) { n ; } else { n = 0; } } return n; } public static int QiYice(float[] numberszx) { float Avg = 0; float sum = 0; if (numberszx.Length != 0) { for (int i = 0; i < numberszx.Length; i ) { sum = sum numberszx[i]; } Avg = sum / numberszx.Length; } int n = 0; for (int i = 0; i < numberszx.Length; i ) { if (numberszx[i]-Avg<0) { n ; } else { n = 0; } } return n; } public static int QiYice2(float[] numberszx) { float Avg = 0; float sum = 0; if (numberszx.Length != 0) { for (int i = 0; i < numberszx.Length;i ) { sum = sum numberszx[i]; } Avg = sum / numberszx.Length; } int n = 0; for (int i = 0; i < numberszx.Length;i ) { if (numberszx[i] - Avg > 0) { n ; } else { n = 0; } } return n; } public static float GetMax(float[] numberszd) { float max = numberszd[0]; for (int i = 0; i < numberszd.Length; i ) { if (max <= numberszd[i]) { max = numberszd[i]; } } return max; } public static float GetMin(float[] numberszx) { float min = numberszx.Min(); return min; } private void button1_Click(object sender, EventArgs e) { qt5 = 1.0f; while ( qt5 < 1.33 ) { float pj = (Convert.ToSingle(textBox101.Text) Convert.ToSingle(textBox102.Text)) / 2; float[] array = new float[100]; Random rand = new Random(); if (checkBox1.Checked == true) { zx = Convert.ToInt32(((pj - (Convert.ToSingle(textBox102.Text) - pj)/2))*1000); zd = Convert.ToInt32(((pj (Convert.ToSingle(textBox102.Text) - pj) / 2))*1000 1); cs = 1000; for (int xh = 0; xh <= 99;) { int rd = rand.Next(zx, zd); //float rdd = rd / 1000; array[xh] = rd; xh ; } } if (checkBox2.Checked == true) { zx = Convert.ToInt32(((pj - (Convert.ToSingle(textBox102.Text) - pj) / 2)) * 100); zd = Convert.ToInt32(((pj (Convert.ToSingle(textBox102.Text) - pj) / 2)) * 100 1); cs = 100; for (int xh = 0; xh <= 99;) { int rd = rand.Next(zx, zd); //float rdd = rd / 1000; array[xh] = rd; xh ; } } if (checkBox3.Checked == true) { int xh = 0; zx = Convert.ToInt32(((pj - (Convert.ToSingle(textBox102.Text) - pj) / 2)) * 100); zd = Convert.ToInt32(((pj (Convert.ToSingle(textBox102.Text) - pj) / 2)) * 100 1); cs = 100; int rd = 3; while (xh < 100) { if (rd % 2 == 0) { //float rdd = rd / 1000; array[xh] = rd; rd = rand.Next(zx, zd); xh ; } else { rd = rand.Next(zx, zd); } } } if (checkBox4.Checked == true) { int xh = 0; zx = Convert.ToInt32(((pj - (Convert.ToSingle(textBox102.Text) - pj) / 2)) * 10); zd = Convert.ToInt32(((pj (Convert.ToSingle(textBox102.Text) - pj) /2)) * 10 1); cs = 10; int rd = 6; while (xh < 100) { if (rd % 5 == 0) { //float rdd = rd / 1000; array[xh] = rd; rd = rand.Next(zx, zd); xh ; } else { rd = rand.Next(zx, zd); } } } int rddd = rand.Next(zx, zd); a1 = array[0] / cs; b1 = array[1] / cs; c1 = array[2] / cs; d1 = array[3] / cs; e1 = array[4] / cs; f1 = array[5] / cs; g1 = array[6] / cs; h1 = array[7] / cs; i1 = array[8] / cs; j1 = array[9] / cs; k1 = array[10] / cs; l1 = array[11] / cs; m1 = array[12] / cs; n1 = array[13] / cs; o1 = array[14] / cs; p1 = array[15] / cs; q1 = array[16] / cs; r1 = array[17] / cs; s1 = array[18] / cs; t1 = array[19] / cs; u1 = array[20] / cs; v1 = array[21] / cs; w1 = array[22] / cs; x1 = array[23] / cs; y1 = array[24] / cs; a2 = array[25] / cs; b2 = array[26] / cs; c2 = array[27] / cs; d2 = array[28] / cs; e2 = array[29] / cs; f2 = array[30] / cs; g2 = array[31] / cs; h2 = array[32] / cs; i2 = array[33] / cs; j2 = array[34] / cs; k2 = array[35] / cs; l2 = array[36] / cs; m2 = array[37] / cs; n2 = array[38] / cs; o2 = array[39] / cs; p2 = array[40] / cs; q2 = array[41] / cs; r2 = array[42] / cs; s2 = array[43] / cs; t2 = array[44] / cs; u2 = array[45] / cs; v2 = array[46] / cs; w2 = array[47] / cs; x2 = array[48] / cs; y2 = array[49] / cs; a3 = array[50] / cs; b3 = array[51] / cs; c3 = array[52] / cs; d3 = array[53] / cs; e3 = array[54] / cs; f3 = array[55] / cs; g3 = array[56] / cs; h3 = array[57] / cs; i3 = array[58] / cs; j3 = array[59] / cs; k3 = array[60] / cs; l3 = array[61] / cs; m3 = array[62] / cs; n3 = array[63] / cs; o3 = array[64] / cs; p3 = array[65] / cs; q3 = array[66] / cs; r3 = array[67] / cs; s3 = array[68] / cs; t3 = array[69] / cs; u3 = array[70] / cs; v3 = array[71] / cs; w3 = array[72] / cs; x3 = array[73] / cs; y3 = array[74] / cs; a4 = array[75] / cs; b4 = array[76] / cs; c4 = array[77] / cs; d4 = array[78] / cs; e4 = array[79] / cs; f4 = array[80] / cs; g4 = array[81] / cs; h4 = array[82] / cs; i4 = array[83] / cs; j4 = array[84] / cs; k4 = array[85] / cs; l4 = array[86] / cs; m4 = array[87] / cs; n4 = array[88] / cs; o4 = array[89] / cs; p4 = array[90] / cs; q4 = array[91] / cs; r4 = array[92] / cs; s4 = array[93] / cs; t4 = array[94] / cs; u4 = array[95] / cs; v4 = array[96] / cs; w4 = array[97] / cs; x4 = array[98] / cs; y4 = array[99] / cs; textBox1.Text = a1.ToString(); textBox2.Text = b1.ToString(); textBox3.Text = c1.ToString(); textBox4.Text = d1.ToString(); textBox5.Text = e1.ToString(); textBox6.Text = f1.ToString(); textBox7.Text = g1.ToString(); textBox8.Text = h1.ToString(); textBox9.Text = i1.ToString(); textBox10.Text = j1.ToString(); textBox11.Text = k1.ToString(); textBox12.Text = l1.ToString(); textBox13.Text = m1.ToString(); textBox14.Text = n1.ToString(); textBox15.Text = o1.ToString(); textBox16.Text = p1.ToString(); textBox17.Text = q1.ToString(); textBox18.Text = r1.ToString(); textBox19.Text = s1.ToString(); textBox20.Text = t1.ToString(); textBox21.Text = u1.ToString(); textBox22.Text = v1.ToString(); textBox23.Text = w1.ToString(); textBox24.Text = x1.ToString(); textBox25.Text = y1.ToString(); textBox26.Text = a2.ToString(); textBox27.Text = b2.ToString(); textBox28.Text = c2.ToString(); textBox29.Text = d2.ToString(); textBox30.Text = e2.ToString(); textBox31.Text = f2.ToString(); textBox32.Text = g2.ToString(); textBox33.Text = h2.ToString(); textBox34.Text = i2.ToString(); textBox35.Text = j2.ToString(); textBox36.Text = k2.ToString(); textBox37.Text = l2.ToString(); textBox38.Text = m2.ToString(); textBox39.Text = n2.ToString(); textBox40.Text = o2.ToString(); textBox41.Text = p2.ToString(); textBox42.Text = q2.ToString(); textBox43.Text = r2.ToString(); textBox44.Text = s2.ToString(); textBox45.Text = t2.ToString(); textBox46.Text = u2.ToString(); textBox47.Text = v2.ToString(); textBox48.Text = w2.ToString(); textBox49.Text = x2.ToString(); textBox50.Text = y2.ToString(); textBox51.Text = a3.ToString(); textBox52.Text = b3.ToString(); textBox53.Text = c3.ToString(); textBox54.Text = d3.ToString(); textBox55.Text = e3.ToString(); textBox56.Text = f3.ToString(); textBox57.Text = g3.ToString(); textBox58.Text = h3.ToString(); textBox59.Text = i3.ToString(); textBox60.Text = j3.ToString(); textBox61.Text = k3.ToString(); textBox62.Text = l3.ToString(); textBox63.Text = m3.ToString(); textBox64.Text = n3.ToString(); textBox65.Text = o3.ToString(); textBox66.Text = p3.ToString(); textBox67.Text = q3.ToString(); textBox68.Text = r3.ToString(); textBox69.Text = s3.ToString(); textBox70.Text = t3.ToString(); textBox71.Text = u3.ToString(); textBox72.Text = v3.ToString(); textBox73.Text = w3.ToString(); textBox74.Text = x3.ToString(); textBox75.Text = y3.ToString(); textBox76.Text = a4.ToString(); textBox77.Text = b4.ToString(); textBox78.Text = c4.ToString(); textBox79.Text = d4.ToString(); textBox80.Text = e4.ToString(); textBox81.Text = f4.ToString(); textBox82.Text = g4.ToString(); textBox83.Text = h4.ToString(); textBox84.Text = i4.ToString(); textBox85.Text = j4.ToString(); textBox86.Text = k4.ToString(); textBox87.Text = l4.ToString(); textBox88.Text = m4.ToString(); textBox89.Text = n4.ToString(); textBox90.Text = o4.ToString(); textBox91.Text = p4.ToString(); textBox92.Text = q4.ToString(); textBox93.Text = r4.ToString(); textBox94.Text = s4.ToString(); textBox95.Text = t4.ToString(); textBox96.Text = u4.ToString(); textBox97.Text = v4.ToString(); textBox98.Text = w4.ToString(); textBox99.Text = x4.ToString(); textBox100.Text =y4.ToString(); a5 = (a1 a2 a3 a4) / 4; b5 = (b1 b2 b3 b4) / 4; c5 = (c1 c2 c3 c4) / 4; d5 = (d1 d2 d3 d4) / 4; e5 = (e1 e2 e3 e4) / 4; f5 = (f1 f2 f3 f4) / 4; g5 = (g1 g2 g3 g4) / 4; h5 = (h1 h2 h3 h4) / 4; i5 = (i1 i2 i3 i4) / 4; j5 = (j1 j2 j3 j4) / 4; k5 = (k1 k2 k3 k4) / 4; l5 = (l1 l2 l3 l4) / 4; m5 = (m1 m2 m3 m4) / 4; n5 = (n1 n2 n3 n4) / 4; o5 = (o1 o2 o3 o4) / 4; p5 = (p1 p2 p3 p4) / 4; q5 = (q1 q2 q3 q4) / 4; r5 = (r1 r2 r3 r4) / 4; s5 = (s1 s2 s3 s4) / 4; t5 = (t1 t2 t3 t4) / 4; u5 = (u1 u2 u3 u4) / 4; v5 = (v1 v2 v3 v4) / 4; w5 = (w1 w2 w3 w4) / 4; x5 = (x1 x2 x3 x4) / 4; y5 = (y1 y2 y3 y4) / 4; a6 = GetMax(new float[] { a1, a2, a3, a4 }) - GetMin(new float[] { a1, a2, a3, a4 }); b6 = GetMax(new float[] { b1, b2, b3, b4 }) - GetMin(new float[] { b1, b2, b3, b4 }); c6 = GetMax(new float[] { c1, c2, c3, c4 }) - GetMin(new float[] { c1, c2, c3, c4 }); d6 = GetMax(new float[] { d1, d2, d3, d4 }) - GetMin(new float[] { d1, d2, d3, d4 }); e6 = GetMax(new float[] { e1, e2, e3, e4 }) - GetMin(new float[] { e1, e2, e3, e4 }); f6 = GetMax(new float[] { f1, f2, f3, f4 }) - GetMin(new float[] { f1, f2, f3, f4 }); g6 = GetMax(new float[] { g1, g2, g3, g4 }) - GetMin(new float[] { g1, g2, g3, g4 }); h6 = GetMax(new float[] { h1, h2, h3, h4 }) - GetMin(new float[] { h1, h2, h3, h4 }); i6 = GetMax(new float[] { i1, i2, i3, i4 }) - GetMin(new float[] { i1, i2, i3, i4 }); j6 = GetMax(new float[] { j1, j2, j3, j4 }) - GetMin(new float[] { j1, j2, j3, j4 }); k6 = GetMax(new float[] { k1, k2, k3, k4 }) - GetMin(new float[] { k1, k2, k3, k4 }); l6 = GetMax(new float[] { l1, l2, l3, l4 }) - GetMin(new float[] { l1, l2, l3, l4 }); m6 = GetMax(new float[] { m1, m2, m3, m4 }) - GetMin(new float[] { m1, m2, m3, m4 }); n6 = GetMax(new float[] { n1, n2, n3, n4 }) - GetMin(new float[] { n1, n2, n3, n4 }); o6 = GetMax(new float[] { o1, o2, o3, o4 }) - GetMin(new float[] { o1, o2, o3, o4 }); p6 = GetMax(new float[] { p1, p2, p3, p4 }) - GetMin(new float[] { p1, p2, p3, p4 }); q6 = GetMax(new float[] { q1, q2, q3, q4 }) - GetMin(new float[] { q1, q2, q3, q4 }); r6 = GetMax(new float[] { r1, r2, r3, r4 }) - GetMin(new float[] { r1, r2, r3, r4 }); s6 = GetMax(new float[] { s1, s2, s3, s4 }) - GetMin(new float[] { s1, s2, s3, s4 }); t6 = GetMax(new float[] { t1, t2, t3, t4 }) - GetMin(new float[] { t1, t2, t3, t4 }); u6 = GetMax(new float[] { u1, u2, u3, u4 }) - GetMin(new float[] { u1, u2, u3, u4 }); v6 = GetMax(new float[] { v1, v2, v3, v4 }) - GetMin(new float[] { v1, v2, v3, v4 }); w6 = GetMax(new float[] { w1, w2, w3, w4 }) - GetMin(new float[] { w1, w2, w3, w4 }); x6 = GetMax(new float[] { x1, x2, x3, x4 }) - GetMin(new float[] { x1, x2, x3, x4 }); y6 = GetMax(new float[] { y1, y2, y3, y4 }) - GetMin(new float[] { y1, y2, y3, y4 }); textBox110.Text = a6.ToString(); textBox111.Text = b6.ToString(); textBox112.Text = c6.ToString(); textBox113.Text = d6.ToString(); textBox114.Text = e6.ToString(); textBox115.Text = f6.ToString(); textBox116.Text = g6.ToString(); textBox117.Text = h6.ToString(); textBox118.Text = i6.ToString(); textBox119.Text = j6.ToString(); textBox120.Text = k6.ToString(); textBox121.Text = l6.ToString(); textBox122.Text = m6.ToString(); textBox123.Text = n6.ToString(); textBox124.Text = o6.ToString(); textBox125.Text = p6.ToString(); textBox126.Text = q6.ToString(); textBox127.Text = r6.ToString(); textBox128.Text = s6.ToString(); textBox129.Text = t6.ToString(); textBox130.Text = u6.ToString(); textBox131.Text = v6.ToString(); textBox132.Text = w6.ToString(); textBox133.Text = x6.ToString(); textBox134.Text = y6.ToString(); pingjun1 = (a5 b5 c5 d5 e5 f5 g5 h5 i5 j5 k5 l5 m5 n5 o5 p5 q5 r5 s5 t5 u5 v5 w5 x5 y5) / 25; pingjun2 = (a6 b6 c6 d6 e6 f6 g6 h6 i6 j6 k6 l6 m6 n6 o6 p6 q6 r6 s6 t6 u6 v6 w6 x6 y6) / 25; pingjun1 = float.Parse(pingjun1.ToString("0.0000")); //pingjun2 = float.Parse(pingjun2.ToString("0.0000")); qt1 = pingjun2 / 2.06f; qt2 = (Convert.ToSingle(textBox102.Text) - pingjun1) / qt1; qt3 = (pingjun1 - Convert.ToSingle(textBox101.Text)) / qt1; shangbianjie = ((pingjun1 0.73f * pingjun2) - pingjun1) / 3 pingjun1; xiabianjie = pingjun1 - ((pingjun1 - (pingjun1 - 0.73f * pingjun2)) / 3); shangbianjie2 = (((2.28f * pingjun2) - pingjun2) / 3) pingjun2; if (qt2 < qt3) { qt4 = qt2 / 3; } else { qt4 = qt3 / 3; } float[] bianjie = new float[] { a5, b5, c5, d5, e5, f5, g5, h5, i5, j5, k5, l5, m5, n5, o5, p5, q5, r5, s5, t5, u5, v5, w5, x5, y5 }; float[] bianjie2 = new float[] { a6, b6, c6, d6, e6, f6, g6, h6, i6, j6, k6, l6, m6, n6, o6, p6, q6, r6, s6, t6, u6, v6, w6, x6, y6 }; int shu = 0; int shu2 = 0; for (int i = 0; i < bianjie.Length; i ) { if (bianjie[i] < shangbianjie && bianjie[i] > xiabianjie) { shu ; } else { } } for (int i = 0; i < bianjie2.Length; i ) { if (bianjie2[i] < shangbianjie2 && bianjie2[i] > 0) { shu2 ; } else { } } if (QiUp(new float[] { a5, b5, c5, d5, e5, f5, g5, h5, i5, j5, k5, l5, m5, n5, o5, p5, q5, r5, s5, t5, u5, v5, w5, x5, y5 }) < 7 && QiDown(new float[] { a5, b5, c5, d5, e5, f5, g5, h5, i5, j5, k5, l5, m5, n5, o5, p5, q5, r5, s5, t5, u5, v5, w5, x5, y5 }) < 7 && QiYice(new float[] { a5, b5, c5, d5, e5, f5, g5, h5, i5, j5, k5, l5, m5, n5, o5, p5, q5, r5, s5, t5, u5, v5, w5, x5, y5 }) < 7 && QiYice2(new float[] { a5, b5, c5, d5, e5, f5, g5, h5, i5, j5, k5, l5, m5, n5, o5, p5, q5, r5, s5, t5, u5, v5, w5, x5, y5 }) < 7) { if (QiUp(new float[] { a6, b6, c6, d6, e6, f6, g6, h6, i6, j6, k6, l6, m6, n6, o6, p6, q6, r6, s6, t6, u6, v6, w6, x6, y6 }) < 7 && QiDown(new float[] { a6, b6, c6, d6, e6, f6, g6, h6, i6, j6, k6, l6, m6, n6, o6, p6, q6, r6, s6, t6, u6, v6, w6, x6, y6 }) < 7 && QiYice(new float[] { a6, b6, c6, d6, e6, f6, g6, h6, i6, j6, k6, l6, m6, n6, o6, p6, q6, r6, s6, t6, u6, v6, w6, x6, y6 }) < 7 && QiYice2(new float[] { a6, b6, c6, d6, e6, f6, g6, h6, i6, j6, k6, l6, m6, n6, o6, p6, q6, r6, s6, t6, u6, v6, w6, x6, y6 }) < 7) { if (shu > 10 && shu < 23 && shu2 > 10 && shu2 < 23) { qt5 = qt4; } else { qt5 = 1.0f; } } else { qt5 = 1.0f; } } else { qt5 = 1.0f; } if (qt5 > 1.57f && shu < 11 && shu > 22 && shu2 < 11 && shu2 > 22) { qt5 = 1.0f; } else { } //qt5 = 1.5f; textBox105.Text = qt5.ToString(); //qt5 = 1.5f; } } } }
好例子网口号:伸出你的我的手 — 分享!
相关软件
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论