俄罗斯分拣丹尼尔林

状态
不接受进一步的答复。

丹林

活跃成员
已加入
2018年10月19日
留言内容
28
编程经验
10+
俄罗斯分拣半和快速和人性化
在QB64上以2.2秒排序1'000'000
在PureBasic上在0.3秒内对1'000'000进行排序

我对用C#语言实现算法感兴趣

元素数量通过c:/N.txt或使用变量n写入文件
array d(n) 可以从文件中读取或在福彩12选5走势图中合成

C#:
' 俄罗斯分拣丹尼尔林
 
DECLARE SUB RussianSortingHalvesDAV (ab!, yz!, part!, age!)
CLOSE
OPEN "c:/N.txt" FOR INPUT AS #1
INPUT #1, n
'n=1234567
age = 1 + LOG(n) / LOG(2)
PRINT n
 
DIM SHARED d(n) 'AS LONG
DIM SHARED a(n) 'AS LONG
 
'OPEN "c:/ISX.txt" FOR INPUT AS #2
'FOR i=1 TO n: INPUT #2, d(i): NEXT
 
'FOR i = 1 TO n: d(i) = n - i + 1: NEXT ' INT(RND*n)
FOR i = 1 TO n: d(i) = INT(RND * n): NEXT '
 
FOR k = 1 TO 20: PRINT d(k);: NEXT: PRINT: PRINT
FOR k = n - 19 TO n: PRINT d(k);: NEXT: PRINT: PRINT
 
start = TIMER
 
IF age > 0 THEN
    CALL RussianSortingHalvesDAV(1, n, 1, age)
END IF
 
finish = TIMER
 
PRINT finish - start; "second ": PRINT
 
OPEN "c:/=RuSortHalves_dav.txt" FOR OUTPUT AS #3
PRINT #3, finish - start; "second "
PRINT #3, n; "elements", "RECURSION"
FOR i = 1 TO 22: PRINT #3, d(i): NEXT
FOR i = n - 22 TO n: PRINT #3, d(i): NEXT
 
FOR k = 1 TO 20: PRINT d(k);: NEXT: PRINT: PRINT
FOR k = n - 19 TO n: PRINT d(k);: NEXT: PRINT: PRINT
 
END
 
SUB RussianSortingHalvesDAV (ab, yz, part, age)
 
IF yz - ab < 1 THEN EXIT SUB
 
FOR i = ab TO yz
    summa = summa + d(i)
NEXT
middle = summa / (yz - ab + 1)
 
abc = ab - 1
xyz = yz + 1
 
FOR i = ab TO yz
    IF d(i) < middle THEN abc = abc + 1: a(abc) = d(i): ELSE xyz = xyz - 1: a(xyz) = d(i)
NEXT
 
FOR i = ab TO yz: d(i) = a(i): NEXT
 
IF part < age THEN
    IF abc >= ab THEN CALL RussianSortingHalvesDAV(ab, abc, part + 1, age)
    IF xyz <= yz THEN CALL RussianSortingHalvesDAV(xyz, yz, part + 1, age)
END IF
 
END SUB

俄罗斯分拣将Danilin可视化
//www.youtube.com/watch?v=UxvSwOtpiuc
//www.youtube.com/watch?v=9poxfAcbxFQ

rusortpol10.gif


我对用C#语言实现算法感兴趣
 

金西尼

C#论坛主持人
工作人员
已加入
2011年4月23日
留言内容
3,566
地点
悉尼,澳大利亚
编程经验
10+
如果您知道如何编写C#代码,请尝试自己实现该算法,然后在遇到特定问题时在此处发布。如果您不知道如何编写C#代码,则需要首先学习。我的签名下面有一个教程链接。然后,如果遇到实际问题,则可以尝试实现该算法,并在此处发回。
 

丹林

活跃成员
已加入
2018年10月19日
留言内容
28
编程经验
10+
有一个超级分类可视化
同时比较2种排序。

该福彩12选5走势图是用未知语言编写的。
我想源代码是:CSharp

?给定代码Csharp?

C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace SortComparison
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new frmMain());
        }
    }
}

?给定代码Csharp?

total.png
 

丹林

活跃成员
已加入
2018年10月19日
留言内容
28
编程经验
10+
俄罗斯分拣半和快速和人性化
在C#Csharp中在0.2秒内对1'000'000进行排序

C#:
// RUSSIAN SORTING HALVES DANILIN
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace davApp
{
    class Program
    {
        private long age;
        static long[] a;
        static long[] d;

        static void Main(string[] args)
        {
            int n = 0;
            // READ NUMBERS
            var inpFile = new StreamReader("N.txt");
            n = Convert.ToInt32(inpFile.ReadLine());
            inpFile.Close();

            var age = 1 + Math.Log(n) / Math.Log(2);

            Console.WriteLine(n);

            a = new long[n + 1];
            d = new long[n + 1];

            for (int i = 1; i <= n; i++)
                d[i] = n - i + 1;

            //var rand = new Random();
            //// RANDOM [1;n]
            //for (int i = 1; i <= n; i++)
            //    d[i] = rand.Next(1, n);

            // REAN N LINE FROM FILE
            //inpFile = new StreamReader("ISX.txt");
            //for (int i = 1; i <= n; i++)
            //    d[i] = Convert.ToInt64(inpFile.ReadLine());
            //inpFile.Close();

            // WRITE ON SCREEN
            int m = Math.Min(n, 20);
            for (int i = 1; i <= m; i++)
                Console.Write("{0} ", d[i]);
            Console.WriteLine();

            // RUSSIAN SORTING HALVES DANILIN
            var start = DateTime.Now;
            if (age > 0)
                dav(1, n, 1, age);
            var finish = DateTime.Now;

            Console.WriteLine("{0} second", (finish - start).TotalSeconds);

            // WRITE ON SCREEN
            Console.WriteLine("[1..{0}]", m);
            for (int i = 1; i <= m; i++)
                Console.Write("{0} ", d[i]);
            Console.WriteLine();

            // WRITE ON SCREEN
            Console.WriteLine("[{0}..{1}]", n - m + 1, n);
            for (int i = n - m + 1; i <= n; i++)
                Console.Write("{0} ", d[i]);
            Console.WriteLine();

            // WRITE IN FILE
            var outFile = new StreamWriter("dav.txt");
            for (int i = 1; i <= m; i++)
                outFile.WriteLine(d[i]);
            outFile.WriteLine();

            for (int i = n - m + 1; i <= n; i++)
                outFile.WriteLine(d[i]);
            outFile.WriteLine();
            outFile.Close();

            Console.WriteLine("Press any key");
            Console.ReadKey();
        }

        static void dav(int ab, int yz, int part, double age)
        {
            if (yz - ab < 1)
                return;

            long summa = 0;
            for (int i = ab; i <= yz; i++)
                summa = summa + d[i];

            double middle = summa / (yz - ab + 1.0);

            var abc = ab - 1;
            var xyz = yz + 1;

            for (int i = ab; i <= yz; i++)
                if (d[i] < middle)
                {
                    abc = abc + 1;
                    a[abc] = d[i];
                }
                else
                {
                    xyz = xyz - 1;
                    a[xyz] = d[i];
                }

            for (int i = ab; i <= yz; i++)
                d[i] = a[i];

            if (part < age)
            {
                if (abc >= ab) dav(ab, abc, part + 1, age);
                if (xyz <= yz) dav(xyz, yz, part + 1, age);
            }
            return;
        }
   }
}

俄罗斯分拣半和快速和人性化
在QB64上以2.2秒排序1'000'000
在PureBasic上在0.3秒内对1'000'000进行排序
在C#Csharp中在0.2秒内对1'000'000进行排序
在Freebasic上的0.15秒内对1'000'000进行排序
 
Last edited:

丹林

活跃成员
已加入
2018年10月19日
留言内容
28
编程经验
10+
在我上面的C#福彩12选5走势图中应用
时间控制内的气泡排序
与删除递归

结果:100'000个排序了60秒的气泡

同时证明适应我的发展是多么容易
使用3种方法测试任何排序算法

但是100,000个项目
俄语排序一半在0.015秒内排序

rshemblems.png
 

丹林

活跃成员
已加入
2018年10月19日
留言内容
28
编程经验
10+
4倍加速证明

C#:
// Russian Sorting Halves 4 part accelerate bubble sorting 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace octoberApp
{
    class Program
    {
        static int n;
        static double[] d;
        static double[] a;
        static double[] v;
        static int[] q;

        static void Main(string[] args)
        {
            n = 57539; 

            d = new double[n+1];
            a = new double[n+1];
            v = new double[n+1];
            q = new int[5+1];
            var rand = new Random();
            for (int i = 1; i <= n; i++)
                d[i] = Math.Truncate(rand.NextDouble() * n);

            for (int i = 1; i <= 10; i++)
                Console.Write("{0} ", d[i]);
            Console.WriteLine();

            for (int i = n - 9; i <= n; i++)
                Console.Write("{0} ", d[i]);
            Console.WriteLine();
            Console.WriteLine();

            var start = DateTime.Now;
            var s = 0;
            //ALL
            double summa = 0;
            for (int i = 1; i <= n; i++)
                summa += d[i];
            double middle = summa / n;
            var y = 1;
            var z = 0;

            for (int i = 1; i <= n; i++)
                if (d[i] < middle)
                {
                    a[y] = d[i]; y++;
                }
                else
                {
                    a[n - z] = d[i];
                    z++;
                }

            q[3] = y - 1;
            Console.WriteLine("ALL middle = {0}", middle);

            for (int i = 1; i <= 10; i++)
                Console.Write("{0} ", a[i]);
            Console.WriteLine();
            Console.WriteLine();
            for (int i = n - 9; i <= n; i++)
                Console.Write("{0} ", a[i]);
            Console.WriteLine();
            Console.WriteLine();

            // 1 FROM 2
            summa = 0;
            for (int i = 1; i <= q[3]; i++)
                summa += a[i];

            middle = summa / q[3];
            y = 1;
            z = 0;
            Console.WriteLine("1 FROM 2 = {0} 1 ...{1}", middle, q[3]);

            for (int i = 1; i <= q[3]; i++)
                if (a[i] < middle)
                {
                    v[y] = a[i]; y++;
                }
                else
                {
                    v[q[3] - z] = a[i];
                    z++;
                }

            for (int i = 1; i <= 10; i++)
                Console.Write("{0} ", v[i]);
            Console.WriteLine();
            for (int i = q[3] - 9; i <= q[3]; i++)
                Console.Write("{0} ", v[i]);
            Console.WriteLine();
            Console.WriteLine();

            q[2] = y - 1;

            // 2 FROM 2
            summa = 0;
            for (int i = q[3] + 1; i <= n; i++)
                summa += a[i];
            middle = summa / (1 + n - q[3]);
            y = q[3];
            z = 0;
            Console.WriteLine("2 FROM 2 = {0} {1}...{2}", middle, q[3] + 1, n);
            for (int i = q[3]; i <= n; i++)
                if (a[i] < middle)
                {
                    v[y] = a[i]; y++;
                }
                else
                {
                    v[n - z] = a[i];
                    z++;
                }
            for (int i = q[3]; i <= q[3] + 10; i++)
                Console.Write("{0} ", v[i]);
            Console.WriteLine();
            for (int i = n - 9; i <= n; i++)
                Console.Write("{0} ", v[i]);
            Console.WriteLine();
            Console.WriteLine();

            q[4] = y - 1;
            q[1] = 2;
            q[5] = n;

            //BUBBLE
            Console.WriteLine("1= {0} 2= {1} 3= {2} 4= {3} 5= {4}", 1, q[2], q[3], q[4], n);
            Console.WriteLine();

            for (int t = 1; t <= 4; t++)
                for (int i = q[t] - 1; i <= q[t + 1]; i++)
                    for (int j = i + 1; j <= q[t + 1]; j++)
                        if (v[i] > v[j])
                        {
                            var x = v[i];
                            v[i] = v[j];
                            v[j] = x;
                            s++;
                        }

            var finish = DateTime.Now;

            for (int i = 1; i <= 10; i++)
                Console.Write("{0} ", v[i]);
            Console.WriteLine();

            for (int i = n - 9; i <= n; i++)
                Console.Write("{0} ", v[i]);
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("DArus4 {0} second swap {1}", (finish - start).TotalSeconds, s);

            var outFile = new System.IO.StreamWriter("RUoct.txt");
            outFile.WriteLine("DArus4 {0} second swap {1}", (finish - start).TotalSeconds, s);
            outFile.WriteLine("{0} 4 parts bubble ", n);

            for (int i = 1; i <= n / 2; i++)
                outFile.WriteLine(v[i]);
            for (int i = n / 2; i <= n; i++)
                outFile.WriteLine(v[i]);

            outFile.Close();

            start = DateTime.Now;
            s = 0;

            for (int i = 1; i <= n; i++)
                for (int j = i + 1; j <= n; j++)
                    if (d[i] > d[j])
                    {
                        var x = d[i];
                        d[i] = d[j];
                        d[j] = x;
                        s++;
                    }
            finish = DateTime.Now;

            Console.WriteLine("BUBBLE {0} second swap {1}", (finish - start).TotalSeconds, s);

            Console.WriteLine("Press any key");
            Console.ReadKey();
        }
    }
}

4倍加速证明

da44bubble.png数组分为4个部分会立即发生
名称q(3)将替换为一个更简单的名称

但是尝试进行2个嵌套循环的分离
中点顺序中断3 2 4

导致带有第二个括号的数组
这会使理解变得更加复杂,并且更好地应用

类型Middle3的语音变量
分开留下3个周期
 
Last edited:

丹林

活跃成员
已加入
2018年10月19日
留言内容
28
编程经验
10+
我们学习C#的基础知识& Excel & qb64

?为什么选择C#& Basic & Excel & qb64?
因为C#& qb64 are compiled

我在Win7中有一个C#csc.exe编译器
并通过单个蝙蝠进行编译

Excel:甚至是小型环境
基本:qb64与Win7兼容

qb64二次方程式:

C#:
' quadratic equation QB64 DAV
INPUT "INPUT A"; A
INPUT "INPUT B"; B
INPUT "INPUT C"; C

D = B ^ 2 - 4 * A * C
IF D < 0 THEN PRINT "D<0 ": END

PRINT "ANSWER: "
PRINT "D ="; D

X1 = (-B + SQR(D)) / (2 * A)
X2 = (-B - SQR(D)) / (2 * A)
PRINT "X1 ="; X1
PRINT "X2 ="; X2
END

C#二次方程式,无需检查d<0:

C#:
// quadratic equation C# DAV
using System;
using System.Text;
using System.IO;
namespace DAV
{
    class Program
        {
    static void Main(string[] args)
    {
Console.Write("INPUT A: ");
long a = Convert.ToInt32(Console.ReadLine());
Console.Write("INPUT B: ");
long b = Convert.ToInt32(Console.ReadLine());
Console.Write("INPUT C: ");
long c = Convert.ToInt32(Console.ReadLine());

long d = (b * b - 4 * a * c);
Console.WriteLine("ANSWER: ");
Console.Write("D = ");
Console.WriteLine(d);

var x1 = (-b + Math.Sqrt(d)) / (2 * a);
var x2 = (-b - Math.Sqrt(d)) / (2 * a);

Console.Write("X1 = ");
Console.WriteLine(x1);
Console.Write("X2 = ");
Console.WriteLine(x2);

        Console.ReadKey();
        }
    }
}

excel二次方程式,无需检查d<0:
excel:复制并粘贴在A1中

C#:
6
7
2
=A2^2-4*A1*A3
=(-A2+(A4^(1/2)))/(2*A1)
=(-A2-(A4^(1/2)))/(2*A1)

进一步需要检查条件
制作玩具"guess number"
 
由主持人最后编辑:

丹林

活跃成员
已加入
2018年10月19日
留言内容
28
编程经验
10+
qb64 1分钟创建了主线并发布了几分钟
由互联网提示创建的具有新想法的3小时内的C#

C#:
'qb64 dav guess number from 0 to 100 with counting of steps 
RANDOMIZE TIMER
s = INT(RND * 100)
t = 0

10 PRINT: t = t + 1:
INPUT "your variant"; a

IF a < s THEN PRINT "need MORE": GOTO 10
IF a > s THEN PRINT "need less": GOTO 10
PRINT "win by"; t; "steps"
END

C#:
'//C# dav guess number from 0 to 100 with counting of steps 
using System;
using System.Text;
namespace DAV 
{
    class Program
        {
    static void Main(string[] args) 
    {
Random rand = new Random();
int s = rand.Next(100);
int t = 0;

dav:
Console.WriteLine();
t++;

Console.Write("your variant ");
string d = Console.ReadLine();
int a = Convert.ToInt32(d);

if(a > s)
    {
    Console.WriteLine("need less");
    goto dav;
    }
else if(a < s)
    {
    Console.WriteLine("need MORE");
    goto dav;
    }
Console.Write("win by ");
Console.Write(t);
Console.Write(" steps"); 
        Console.ReadKey();
        }
    }
}
 

丹林

活跃成员
已加入
2018年10月19日
留言内容
28
编程经验
10+
C#:
'milliard & billion qb64 DAV guess 1 number of 1'OOO'000'ooo by 30 steps

RANDOMIZE TIMER
h2 = INT(RND * 10 ^ 9)
h1 = 0
c = INT(RND * h2) 'comp
h = INT(RND * h2) 'human
t = 0

10 t = t + 1
PRINT t, c, h,

IF h < c THEN PRINT "MORE": a = h: h = INT((h + h2) / 2): h1 = a: GOTO 10
IF h > c THEN PRINT "less": a = h: h = INT((h1 + h) / 2): h2 = a: GOTO 10
PRINT "win by "; t; " steps"
END

注意到C#编译器功能
指出福彩12选5走势图开始时有错误
可能表示末尾缺少字符}

范围从0到100的示例
C#:
1    40    11    MORE
2    40    55    less
3    40    33    MORE
4    40    44    less
5    40    38    MORE
6    40    41    less
7    40    39    MORE
8    40    40    win by 8 steps
BasiC#qbc#C ##

检测到在线C#编译器
以及更多没有qbasic的语言
无需注册即可工作

那里有打字福彩12选5走势图是可能的
用福彩12选5走势图保存状态

例如福彩12选5走势图C#Billion
猜1'000'OOO'ooo中的1个
= log(10 ^ 9; 2)在30个动作中

rextester.com/JRGX29275

C#:
//milliard & billion C# DAV guess 1 number of 1000000000 by 30 steps 
using System;
using System.Text;
namespace DAV
{
    class Program
    {
    static void Main(string[] args)
    {
int h2 = 1000000000;//or 500
int h1 = 0;
Random rand = new Random();
int c = rand.Next(h2); //computer
int h = rand.Next(h2); //human or h2/2;
int t = 0;

dav:
t++;
Console.WriteLine();
Console.Write(t);
Console.Write("  ");
Console.Write(c);
Console.Write("  ");
Console.Write(h);
Console.Write("  ");

if(h < c)
    {
    Console.Write("MORE");
    int a = h;
    h = (h + h2) / 2;
    h1 = a;
    goto dav;
    }
else if(h > c)
    {
    Console.Write("less");
    int a = h;
    h = (h1 + h) / 2;
    h2 = a;
    goto dav;
    }
Console.Write("win by ");
Console.Write(t);
Console.Write(" steps");
        Console.ReadKey();
        }
    }
}

搜索可查看存储的福彩12选5走势图... 5年
并且肯定还有一个在线编译器C#
确实是通过Yandex搜索

但由于对图形感兴趣
当我使用cs时& bat
 

丹林

活跃成员
已加入
2018年10月19日
留言内容
28
编程经验
10+
我们绘制5D浮雕以创建高度的随机数组

在QB64上运行5分钟,再加上一个小时
美观和多功能

救济qb.gif


C#:
' 5d relief and array
SCREEN 12: RANDOMIZE TIMER: DIM a(12,12)
FOR t=1 TO 12 ' quantity
    FOR x=1 TO 12: FOR y=1 TO 12
a(x,y)=INT(RND*20)'heights
    NEXT: NEXT: CLS
    FOR y=1 TO 12: FOR x=1 TO 11
LINE (50+20*x+20*y, 400-20*y-a(x,y))-(50+20*(x+1)+20*y, 400-20*y-a(x+1,y)), y
    NEXT: NEXT
    FOR x=1 TO 12: FOR y=1 TO 11
LINE (50+20*x+20*y, 400-20*y-a(x,y))-(50+20*(x+1)+20*y, 400-20*(y+1)-a(x,y+1)), x
    NEXT: NEXT:SLEEP 1
NEXT
END

在C#摆福彩12选5走势图上使用
因为关于计时器的理解还不明确
和随机函数取决于外部/内部循环
并了解另一个随机创建的福彩12选5走势图

如何清除屏幕仍然不清楚,并且构建缓慢
尚不清楚如何通过变量设置线条的颜色

救济cs.gif


仍然如任务管理器所示
简单的C#福彩12选5走势图或数组填充内存
并且只有在结束时,内存清除行才会保存

C#:
//RELIEF
using System;
using System.Drawing;
using System.Windows.Forms;
class RELIEF
{
Timer timer; // it is not clear
Form form;
    
int[,] a = new int[22, 22];
static void Main(string[] args) 
{
var p = new RELIEF();
}
public RELIEF()
{
    form = new Form() { Text = "RELIEF", Width = 600, Height = 360 };
    timer = new Timer() { Interval = 200 }; // it is not clear
    timer.Tick += delegate(object sender, EventArgs e) // it is not clear
    {
    Random rand = new Random();
// heights
    for (int x = 1; x <=12; x++)
    {
    for (int y = 1; y <=12; y++)
    a[x,y]=rand.Next(20);
    }
// parallels X
    for (int y = 1; y <=12; y++)
    {
    for (int x = 1; x <=11; x++)
        {
    var x1 = 50 + 20*x + 20*y; 
    var y1 = 300 - 20*y - a[x,y];
    var x2 = 50 + 20*(x+1) + 20*y;
    var y2 = 300 - 20*y - a[x+1,y];

    Bitmap dblBuffer = new Bitmap(form.Width, form.Height);
    Graphics g = Graphics.FromImage(dblBuffer);
    Graphics f = Graphics.FromHwnd(form.Handle);

    g.DrawLine(Pens.Red, new Point(x1, y1), new Point(x2, y2));
//    f.Clear(Color.Green); // clear screen
    f.DrawImage(dblBuffer, new Point(0, 0));
     }
    }
// parallels Y
    for (int x = 1; x <=12; x++)
    {
    for (int y = 1; y <=11; y++)
    {
    var x1 = 50 + 20*x + 20*y; 
    var y1 = 300 - 20*y - a[x, y];
    var x2 = 50 + 20*(x+1) + 20*y;
    var y2 = 300 - 20*(y+1) - a[x, y+1];

    Bitmap dblBuffer = new Bitmap(form.Width, form.Height);
    Graphics g = Graphics.FromImage(dblBuffer);
    Graphics f = Graphics.FromHwnd(form.Handle);

    g.DrawLine(Pens.Red, new Point(x1, y1), new Point(x2, y2));
//    f.Clear(Color.Green); // clear screen
    f.DrawImage(dblBuffer, new Point(0, 0));
    }
    }
Array.Clear(a, 0, 22); // clears memory
    };
    timer.Start(); // it is not clear
    Application.Run(form);
    }     
}

除了C#摆是C#对角线更简单
并且不包含其他C#福彩12选5走势图
如基本:1个文件= 1个福彩12选5走势图

这就是为什么我给定的5D缓解福彩12选5走势图很重要的原因。
画出至少可以预见的东西
同时我们研究嵌套循环

而且我仍在寻找可编译的图形福彩12选5走势图:

1个文件= 1个福彩12选5走势图
1bas = 1exe& 1cs=1exe

并已经创建了关于弦的研究
 

丹林

活跃成员
已加入
2018年10月19日
留言内容
28
编程经验
10+
这是画人物的问题
与本主题直接相关

因为以下是动画
关于人物运动的例子

animcatcs.gif


动画片"Cat Basic"并可以进行进一步的参数化

C#:
//cat.cs
using System; 
using System.Drawing;
using System.Windows.Forms;

class cat: Form
    {
    public static void Main()
    {
    Application.Run(new cat());
    }
    public cat()
        {
        Text = "cat";
    BackColor = System.Drawing.Color.Blue;
    ForeColor = System.Drawing.Color.Red;
        ResizeRedraw = true;
        Width = 600;
        Height = 360;
        }
    protected override void OnPaint(PaintEventArgs dan)
        {
Pen pen = new Pen(ForeColor);
SolidBrush redBrush = new SolidBrush(Color.Blue);
Graphics dav = dan.Graphics;

    for (int k = 1; k <=5; k++)
    for (int x = -50; x <=50; x++)
    {
int y=0;
if (x< 50) y=-x/5;
if (x< 25) y= x/5;
if (x<-25) y=-x/5;
if (x<-50) y= x/5;

dav.FillRectangle(redBrush, 0, 120, 600, 200);

dav.DrawEllipse(new Pen(Color.Magenta, 3), x*k+195, 225, 10, -80);
dav.DrawEllipse(new Pen(Color.Magenta, 3), x*k+200, 200, 100, 50);
dav.DrawEllipse(new Pen(Color.Magenta, 3), x*k+280, y+170, 50, 50);

dav.DrawEllipse(new Pen(Color.Magenta, 3), x*k+290, y+190, 10, 10);//x/5, x/5
dav.DrawEllipse(new Pen(Color.Magenta, 3), x*k+294, y+194, 2, 2);
dav.DrawEllipse(new Pen(Color.Magenta, 3), x*k+310, y+190, 10, 10);//x/5, x/5
dav.DrawEllipse(new Pen(Color.Magenta, 3), x*k+314, y+194, 2, 2);

dav.DrawEllipse(new Pen(Color.Magenta, 3), x*k+280, y+205, 25, 10);
dav.DrawEllipse(new Pen(Color.Magenta, 3), x*k+310, y+205, 25, 10);

dav.DrawLine(new Pen(Color.Magenta, 3), new Point(x*k+280, y+190), new Point(x*k+280, y+160));
dav.DrawLine(new Pen(Color.Magenta, 3), new Point(x*k+290, y+175), new Point(x*k+280, y+160));
dav.DrawLine(new Pen(Color.Magenta, 3), new Point(x*k+330, y+190), new Point(x*k+330, y+160));
dav.DrawLine(new Pen(Color.Magenta, 3), new Point(x*k+320, y+175), new Point(x*k+330, y+160));

dav.DrawLine(new Pen(Color.Magenta, 3), new Point(x*k+210, 240), new Point(x*k+210, 280));
dav.DrawLine(new Pen(Color.Magenta, 3), new Point(x*k+220, 230), new Point(x*k+220, 290));
dav.DrawLine(new Pen(Color.Magenta, 3), new Point(x*k+280, 230), new Point(x*k+280, 290));
dav.DrawLine(new Pen(Color.Magenta, 3), new Point(x*k+290, 240), new Point(x*k+290, 280));

dav.DrawEllipse(new Pen(Color.Magenta, 3), x*k+205, 275, 10, 10);
dav.DrawEllipse(new Pen(Color.Magenta, 3), x*k+215, 285, 10, 10);
dav.DrawEllipse(new Pen(Color.Magenta, 3), x*k+275, 285, 10, 10);
dav.DrawEllipse(new Pen(Color.Magenta, 3), x*k+285, 275, 10, 10);

System.Threading.Thread.Sleep(10);
}
}
}
 
Last edited:

丹林

活跃成员
已加入
2018年10月19日
留言内容
28
编程经验
10+
使用福彩12选5走势图集合示例
并编译提示获取福彩12选5走势图

二次方程

winquall.gif


C#:
//winquall.cs
using System;
using System.Windows.Forms;
using System.IO;

class winQUAll : Form
{
winQUAll()
{
Text= "winQUAll A=6 B=7 C=2";
BackColor = System.Drawing.Color.Green;
ForeColor = System.Drawing.Color.White;
ResizeRedraw = true;
Width = 400;
Height = 250;
{
var buttons = new Button();
buttons.Text= "SAVE";
buttons.Dock = DockStyle.Top;
    var zc = -7;
    var labelc = new Label();
    var buttonc = new Button();
    buttonc.Text= "C+3";
    buttonc.Dock = DockStyle.Bottom;
var zb = 12;
var labelb = new Label();
var buttonb = new Button();
buttonb.Text= "B-1";
buttonb.Dock = DockStyle.Bottom;
    var za = 2;
    var labela = new Label();
    var buttona = new Button();
    buttona.Text= "A+1";
    buttona.Dock = DockStyle.Bottom;
var labelx = new Label();
    var d = (zb * zb - 4 * za * zc);
    double x1 = (-zb + Math.Sqrt(d)) / (2 * za);
    double x2 = (-zb - Math.Sqrt(d)) / (2 * za);
    var labeld = new Label();
labeld.Text= "d= " + d +"   X1= " + x1 + "   X2= " + x2 + "  ";
labeld.Dock = DockStyle.Top;
x1 = (Math.Truncate(x1 * 100))/100;
x2 = (Math.Truncate(x2 * 100))/100;
    //labeld.Location = new System.Drawing.Point(80, 15);
labelx.Text= "X1=" + x1 + " X2=" + x2 + "  ";
labelx.Location = new System.Drawing.Point(125, 125);
Controls.Add(labeld);
Controls.Add(labelx);
    labelc.Text= "C=" + zc + ".....";
    labelc.Location = new System.Drawing.Point(20, 100);
Controls.Add(labelc);
buttonc.Click += delegate
    {
    zc = zc+3;
    d = (zb * zb - 4 * za * zc);
    x1 = (-zb + Math.Sqrt(d)) / (2 * za);
    x2 = (-zb - Math.Sqrt(d)) / (2 * za);
labeld.Text= "d= " + d +"   X1= " + x1 + "   X2= " + x2 + "  ";
labeld.Dock = DockStyle.Top;
x1 = (Math.Truncate(x1 * 100))/100;
x2 = (Math.Truncate(x2 * 100))/100;
    //labeld.Location = new System.Drawing.Point(80, 15);
labelx.Text= "X1=" + x1 + " X2=" + x2 + "  ";
labelx.Location = new System.Drawing.Point(125, 125);
labelc.Text= "C=" + zc + "  ...";
labelc.Location = new System.Drawing.Point(20, 100);
    };
Controls.Add(buttonc);
Controls.Add(labeld);
Controls.Add(labelx);
    labelb.Text= "B=" + zb + ".....";
    labelb.Location = new System.Drawing.Point(50, 80);
Controls.Add(labelb);
buttonb.Click += delegate
    {
    zb--;
    d = (zb * zb - 4 * za * zc);
    x1 = (-zb + Math.Sqrt(d)) / (2 * za);
    x2 = (-zb - Math.Sqrt(d)) / (2 * za);
labeld.Text= "d= " + d +"   X1= " + x1 + "   X2= " + x2 + "  ";
labeld.Dock = DockStyle.Top;
x1 = (Math.Truncate(x1 * 100))/100;
x2 = (Math.Truncate(x2 * 100))/100;
    //labeld.Location = new System.Drawing.Point(80, 15);
labelx.Text= "X1=" + x1 + " X2=" + x2 + "  ";
labelx.Location = new System.Drawing.Point(125, 125);
labelb.Text= "B=" + zb + "  ...";
labelb.Location = new System.Drawing.Point(50, 80);
    };
Controls.Add(buttonb);
Controls.Add(labeld);
Controls.Add(labelx);
    labela.Text= "A=" + za + ".....";
    labela.Location = new System.Drawing.Point(80, 60);
Controls.Add(labela);
buttona.Click += delegate
    {
    za++;
    d = (zb * zb - 4 * za * zc);
    x1 = (-zb + Math.Sqrt(d)) / (2 * za);
    x2 = (-zb - Math.Sqrt(d)) / (2 * za);
labeld.Text= "d= " + d +"   X1= " + x1 + "   X2= " + x2 + "  ";
labeld.Dock = DockStyle.Top;
x1 = (Math.Truncate(x1 * 100))/100;
x2 = (Math.Truncate(x2 * 100))/100;
    //labeld.Location = new System.Drawing.Point(80, 15);
labelx.Text= "X1=" + x1 + " X2=" + x2 + "  ";
labelx.Location = new System.Drawing.Point(125, 125);
labela.Text= "A=" + za + "  ...";
labela.Location = new System.Drawing.Point(80, 60);
    };
Controls.Add(buttons);
buttons.Click += delegate
    {
var outFile = new StreamWriter("dan.txt");
outFile.WriteLine(za);
outFile.WriteLine(zb);
outFile.WriteLine(zc);
outFile.WriteLine(d);
outFile.WriteLine(x1);
outFile.WriteLine(x2);
outFile.Close();
    };
Controls.Add(buttona);
Controls.Add(labeld);
Controls.Add(labelx);
    };
}
    static void Main()
    {
Application.Run(new winQUAll());
    }
}

1cs = 1exe

然后我测试引擎和窗口内的窗口
 
Last edited:

丹林

活跃成员
已加入
2018年10月19日
留言内容
28
编程经验
10+
sumtab.gif


应用福彩12选5走势图从Windows读取
设置或分配值
并创建计算和设计
使用给定的数据
形式进一步规划的图形

C#:
//SUMCOMB.cs
using System; 
using System.Drawing;
using System.Windows.Forms;
namespace SUMCOMB
{
    public class Program
    {
    static void Main()
    {
Application.Run(new SUMCOMB());
    }
    }
    class SUMCOMB : Form
    {
    ComboBox comboBoxD;
    TextBox textBoxA; 
    Button buttonV;

public SUMCOMB()
    {
var labelD = new Label();
    labelD.Text = "D СТРОК";
    labelD.Location = new System.Drawing.Point(45, 28);
    Controls.Add(labelD);

comboBoxD = new ComboBox();
    comboBoxD.Location = new Point(45, 50);
    comboBoxD.Width = 50;
    comboBoxD.Items.Add("7");
    comboBoxD.Items.Add("5");
    comboBoxD.Items.Add("3");
    comboBoxD.SelectedIndex = 1;
    this.Controls.Add(comboBoxD);

var labelA = new Label();
    labelA.Text = "A СТОЛБЦОВ";
    labelA.Location = new System.Drawing.Point(45, 78);
    Controls.Add(labelA);

textBoxA=new TextBox();
    textBoxA.Text = "4"; 
    textBoxA.Location = new System.Drawing.Point(45, 100);
    this.Controls.Add(textBoxA); 

buttonV = new Button();    
    buttonV.Location = new System.Drawing.Point(45, 200);
    buttonV.Text = "SUMCOMB";
    buttonV.Click+=buttonV_Click;
    Controls.Add(buttonV);
}

private void buttonV_Click(object sender, EventArgs e)
    {
    int dd = int.Parse(comboBoxD.Text);
    int aa = int.Parse(textBoxA.Text);
for (int i = 1; i <= dd; i++)
{
string s= "";
for (int j = 1; j <= aa; j++)
s = s+"  "+(i+j).ToString();
var labelI = new Label();
labelI.Text = s;
labelI.Location = new System.Drawing.Point(145, 25+25*i);
Controls.Add(labelI);
}
        }
    }
}

qbcsworkit.png
 
Last edited:

丹林

活跃成员
已加入
2018年10月19日
留言内容
28
编程经验
10+
福彩12选5走势图之间的数据传输
特别是1个符号:节点数

grafline.gif


C#:
//GRAF11.cs
using System; 
using System.IO;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
namespace GRAF11
{
    public class Program
{
static void Main()
    {
Application.Run(new GRAF11());
    }
    }
    class GRAF11 : Form 
    {
int[] x = new int[10];
int[] y = new int[10];
Random rand = new Random();
ComboBox comboBoxD;
Button buttonA;

    public GRAF11()
    {
comboBoxD = new ComboBox();
    comboBoxD.Location = new Point(45, 50);
    comboBoxD.Width = 50;
    comboBoxD.Items.Add("7");
    comboBoxD.Items.Add("5");
    comboBoxD.Items.Add("3");
    comboBoxD.SelectedIndex = 1;
buttonA = new Button();    
    buttonA.Location = new System.Drawing.Point(30, 80);
    buttonA.Text = "START";
    buttonA.Click+=buttonA_Click;
var labelV = new Label();
    labelV.Text = "CIRCLES";
    labelV.Location = new System.Drawing.Point(45, 28);
Controls.Add(comboBoxD);
Controls.Add(buttonA);
Controls.Add(labelV);
    }
private void buttonA_Click(object sender, EventArgs e)
    {
for (int i = 1; i <10; i++)
        {
x[i]=150+rand.Next(100);
y[i]=20+rand.Next(100);
        }
var outFile = new StreamWriter("dan.txt");
outFile.WriteLine(comboBoxD.Text);
for (int i = 1; i <10; i++)
        {
outFile.WriteLine(x[i]);
outFile.WriteLine(y[i]);
        }
outFile.Close();

    Process.Start("GRAF22.exe");
        }
    }
}

C#:
//GRAF22.cs
using System;
using System.IO;
using System.Drawing;
using System.Windows.Forms;
namespace GRAF22
{
    public class Program
{
static void Main()
    {
Application.Run(new GRAF22());
    }
}
    class GRAF22 : Form
    {
int[] x = new int[10];
int[] y = new int[10];
int[] z = new int[2];

    public GRAF22()
    {
var inpFile = new StreamReader("dan.txt");

z[1] = Convert.ToInt32(inpFile.ReadLine());

for (int i = 1; i <10; i++)
        {
x[i] = Convert.ToInt32(inpFile.ReadLine());
y[i] = Convert.ToInt32(inpFile.ReadLine());
        }
inpFile.Close();
}

protected override void OnPaint(PaintEventArgs dav)
    {
Graphics da = dav.Graphics;
Pen pen = new Pen(ForeColor);
for (int i = 1; i <= z[1]; i++)
da.DrawEllipse(new Pen(Color.Magenta, i), x[i]-5, y[i]-5, 10, 10);

for (int i = 1; i <= z[1]-1; i++)
for (int j = i+1; j <= z[1]; j++)
    {
da.DrawLine(new Pen(Color.Red, i), new Point(x[i], y[i]), new Point(x[j], y[j]));
System.Threading.Thread.Sleep(150);
    }
        }
    }
}
 
Last edited:

丹林

活跃成员
已加入
2018年10月19日
留言内容
28
编程经验
10+
C#版本"guess my number game" 1 line
C#:
使用系统;使用System.Text; namespace GURU {类福彩12选5走势图{static void Main(string [] args){Random rand = new Random(); int俄罗斯= 0; int n = 0; int num = 0; dav:if(俄罗斯== 0){俄罗斯= 2222; num = rand.Next(100)+1; goto dav; }否则,如果(Russia!= 0){Console.Write("? "); n = Convert.ToInt32(Console.ReadLine());}如果(n<num){Console.WriteLine("MORE"); goto dav;}否则,如果(n>num){Console.WriteLine("less"); goto dav;}否则,如果(n== num) {Console.Write("da"); Console.ReadKey(); }其他goto dav;}}} // Danilin俄罗斯2019年9月9日
使用系统;使用System.Text; namespace GURU {类福彩12选5走势图{static void Main(string [] args){Random rand = new Random(); int俄罗斯= 0; int n = 0; int num = 0; dav:if(俄罗斯== 0){俄罗斯= 2222; num = rand.Next(100)+1; goto dav; }否则,如果(Russia!= 0){Console.Write("? "); n = Convert.ToInt32(Console.ReadLine());}如果(n<num){Console.WriteLine("MORE"); goto dav;}否则,如果(n>num){Console.WriteLine("less"); goto dav;}否则,如果(n== num) {Console.Write("da"); Console.ReadKey(); }其他goto dav;}}} // Danilin俄罗斯2019年9月9日

C#版本"guess my number game" 1 line

qbasic版本"guess my number game" 1 line
C#:
1 IF俄罗斯= 0 THEN俄罗斯= 2222:随机计时器:num = INT(RND * 100)+ 1:如果IF俄罗斯则转到1<>0 THEN INPUT n:IF n< num THEN PRINT "MORE": GOTO 1 ELSE IF n > num THEN PRINT "less":如果n = num THEN PRINT,则转到1 ELSE"da":END ELSE GOTO 1'DANILIN俄罗斯2019年9月9日
1 IF俄罗斯= 0 THEN俄罗斯= 2222:随机计时器:num = INT(RND * 100)+ 1:如果IF俄罗斯则转到1<>0 THEN INPUT n:IF n< num THEN PRINT "MORE": GOTO 1 ELSE IF n > num THEN PRINT "less":如果n = num THEN PRINT,则转到1 ELSE"da":END ELSE GOTO 1'DANILIN俄罗斯2019年9月9日

qbasic版本"guess my number game" 1 line
 

羊皮

知名会员
已加入
2018年9月5日
留言内容
1,982
编程经验
10+
您的线程不是定期更新的,应该关闭,因为它是随机的。我希望主持人可以回顾一下该线程的相对性,因为您的帖子非常零星。
 

金西尼

C#论坛主持人
工作人员
已加入
2011年4月23日
留言内容
3,566
地点
悉尼,澳大利亚
编程经验
10+
羊皮是正确的。使用单个线程发布您认为可能对某人有帮助的每个代码示例都不是对本论坛的正确使用。如果您要共享信息,请创建一个带有描述该主题的标题的主题,然后选择"Tip"作为前缀。如果您有关于其他主题的更多信息,请为该主题创建一个新线程。
 
状态
不接受进一步的答复。
最佳 底部