Pull to refresh

Comments 22

Квадратное уравнение qbasic:

' 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 "OTBET: "
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:

// 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("OTBET: ");
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:
скопировав и вставив в A1:

6
7
2
=A2^2-4*A1*A3
=(-A2+КОРЕНЬ(A4))/(2*A1)
=(-A2-КОРЕНЬ(A4))/(2*A1)


rosettacode.org/wiki/Roots_of_a_quadratic_function


Школьная программа соединяет 8 случайных точек

image

как анимация в начале темы

//DAV.cs
using System; using System.Drawing;
using System.Windows.Forms;
class DAV: Form
	{ public static void Main()
	{ Application.Run(new DAV()); }
	public DAV()
{ Text = "DAV"; ResizeRedraw = true; Width = 600; Height = 360;
BackColor = SystemColors.WindowText; ForeColor = SystemColors.Window;
}
	protected override void OnPaint(PaintEventArgs dan)
{ int[] x = new int[10]; int[] y = new int[10];
Random rand = new Random();
	for (int i = 1; i <=8; i++)
{ x[i]=50+rand.Next(400);
y[i]=50+rand.Next(200);
}
Graphics da = dan.Graphics; Pen pen = new Pen(ForeColor);
for (int i = 1; i <=8; i++)
da.DrawEllipse(new Pen(Color.Magenta, i), x[i]-10, y[i]-5, 20, 10);

for (int i = 1; i <= 7; i++)
for (int j = i+1; j <= 8; j++)
{ Graphics dav = dan.Graphics;
dav.DrawLine(new Pen(Color.Red, i), new Point(x[i], y[i]), new Point(x[j], y[j]));
System.Threading.Thread.Sleep(200);
} 
System.Threading.Thread.Sleep(5000);
Array.Clear(x, 0, 10); Array.Clear(y, 0, 10);
}}


Скопировав название DAV.cs использую DAV.bat

csc.exe /target:winexe DAV.cs
pause

Стартуя DAV.bat получаю DAV.exe для Windows

Для ДОС DOS программ иначе dos.bat:

csc.exe /nologo dos.cs
pause


Программирую без оболочек используя чисто блокнот

image

Заголовок программы может включать строки для bat
и ссылки на онлайн компилятор
Windows приложение решает квадратные уравнения D>0 не проверяя

image

//DAVQUA.cs //csc.exe /target:winexe DAVQUA.cs
using System; using System.Windows.Forms;
namespace poleQUA
{ public class Program
	{ static void Main()
	{ Application.Run(new poleQUA());
}}
class poleQUA : Form
{ TextBox textBoxA, textBoxB, textBoxC;
Button buttonD; public poleQUA()
{ textBoxA=new TextBox(); textBoxB=new TextBox(); textBoxC=new TextBox();
textBoxA.Location = new System.Drawing.Point(150, 50);
textBoxB.Location = new System.Drawing.Point(100, 100);
textBoxC.Location = new System.Drawing.Point(50, 150);
	this.Controls.Add(textBoxA); 
	this.Controls.Add(textBoxB); 
	this.Controls.Add(textBoxC); 
var labelq = new Label();
labelq.Text = "Input A= 6 & B= 7 & C= 2";
labelq.Dock = DockStyle.Top;
Controls.Add(labelq);
	var labelA = new Label();
	labelA.Text = "A= ";
	labelA.Location = new System.Drawing.Point(130, 52);
	Controls.Add(labelA);
var labelB = new Label();
labelB.Text = "B= ";
labelB.Location = new System.Drawing.Point(80, 102);
Controls.Add(labelB);
	var labelC = new Label();
	labelC.Text = "C= ";
	labelC.Location = new System.Drawing.Point(30, 152);
	Controls.Add(labelC);
buttonD = new Button();	
	buttonD.Location = new System.Drawing.Point(100, 200);
	buttonD.Text = "D= x1= x2=";
	buttonD.Click+=buttonD_Click;
	this.Controls.Add(buttonD);
	}
private void buttonD_Click(object sender, EventArgs e)
{ int za = Convert.ToInt32(textBoxA.Text);
	int zb = Convert.ToInt32(textBoxB.Text);
	int zc = Convert.ToInt32(textBoxC.Text);
double d = (zb * zb - 4 * za * zc);
double x1 = (-zb + Math.Sqrt(d)) / (2 * za);
double x2 = (-zb - Math.Sqrt(d)) / (2 * za);
	string dd = (d.ToString());
	string xx1 = (x1.ToString());
	string xx2 = (x2.ToString());
	string m = "D= " + dd + "  x1= " + xx1 + "  x2= " + xx2;
{ MessageBox.Show(m);}
}}}


Главнейший принцип: всё в едином файле: 1cs=1exe
Приложение считывает из окон заданные или назначенные значения
и создаёт расчёты и оформление используя данные данные
и далее планируется графика в форме

image

//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);
}}}}


Особенность: готовые значения в окнах и далее
наработки окон и кнопок легко использовать в программах

Форматирование обосабливает блоки компактно учитывая: 1cs=1exe
Передача данных между программами: число узлов записав в файл

image

//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");
}}}


//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);
}}}}


Несколько раз применена конструкция
for (int i = 1; i <= z[1]-1; i++)
for (int j = i+1; j <= z[1]; j++)

без фигурных скобок для единственной следующей строки подряд

image
Собрав знания за час легко создать вручную:

image

плюс кнопки появляются поочерёдно
плюс 1cs=1exe

// DAVPOLE.cs 
// csc.exe /target:winexe POLE.cs
using System; using System.IO;
using System.Drawing; using System.Diagnostics;
using System.Windows.Forms; namespace POLE
{ public class Program
{ static void Main()
{ Application.Run(new POLE());
}}
class POLE : Form 
{ double[] d = new double[5];Random rand = new Random();
ComboBox comboBox1;ComboBox comboBox2;ComboBox comboBox3;ComboBox comboBox4;
Button button1;	Button button2;
TextBox textBox1; TextBox textBox2; TextBox textBox3; TextBox textBox4; 
TextBox textBox5; TextBox textBox6; TextBox textBox7; TextBox textBox8; 

	public POLE()
{ comboBox1 = new ComboBox();
	comboBox1.Location = new Point(45, 50); comboBox1.Width = 40;
comboBox1.Items.AddRange(new string[] {"7","8","9","10","11","12"});
	comboBox1.SelectedIndex = 1;
comboBox2 = new ComboBox();
	comboBox2.Location = new Point(105, 50); comboBox2.Width = 40;
comboBox2.Items.AddRange(new string[] {"24","23","22","21","20","19"});
	comboBox2.SelectedIndex = 3;
comboBox3 = new ComboBox();
	comboBox3.Location = new Point(165, 50); comboBox3.Width = 40;
comboBox3.Items.AddRange(new string[] {"3","2","1","4","5","6"});
	comboBox3.SelectedIndex = 4;
comboBox4 = new ComboBox();
	comboBox4.Location = new Point(225, 50); comboBox4.Width = 40;
comboBox4.Items.AddRange(new string[] {"13","15","17","14","15","16"});
	comboBox4.SelectedIndex = 5;

button1 = new Button();	
	button1.Location = new System.Drawing.Point(115, 80);
	button1.Width = 80; button1.Text = "Пиши Читай";
	button1.Click+=button1_Click;

var label1 = new Label(); label1.Text = "HOMEPA";
	label1.Location = new System.Drawing.Point(125, 28);

Controls.Add(comboBox1);Controls.Add(comboBox2);Controls.Add(comboBox3);
Controls.Add(comboBox4);Controls.Add(button1);Controls.Add(label1); 
	}

private void button1_Click(object sender, EventArgs e)
{ var outFile = new StreamWriter("dan.txt");
outFile.WriteLine(comboBox1.Text);outFile.WriteLine(comboBox2.Text);
outFile.WriteLine(comboBox3.Text);outFile.WriteLine(comboBox4.Text);
outFile.Close(); var inpFile = new StreamReader("dan.txt");

textBox1=new TextBox(); this.Controls.Add(textBox1); 
	textBox1.Text = inpFile.ReadLine(); textBox1.Width = 40;
	textBox1.Location = new System.Drawing.Point(225, 120);
textBox2=new TextBox(); this.Controls.Add(textBox2); 
	textBox2.Text = inpFile.ReadLine(); textBox2.Width = 40;
	textBox2.Location = new System.Drawing.Point(165, 120);
textBox3=new TextBox(); this.Controls.Add(textBox3); 
	textBox3.Text = inpFile.ReadLine(); textBox3.Width = 40;
	textBox3.Location = new System.Drawing.Point(105, 120);
textBox4=new TextBox(); this.Controls.Add(textBox4); 
	textBox4.Text = inpFile.ReadLine(); textBox4.Width = 40;
	textBox4.Location = new System.Drawing.Point(45, 120);
inpFile.Close();

button2 = new Button();	button2.Text = "Улучшь";
	button2.Location = new System.Drawing.Point(115, 160);
	button2.Click+=button2_Click; 	Controls.Add(button2);
	}

	private void button2_Click(object sender, EventArgs e)
{ d[1]=double.Parse(textBox1.Text);d[2]=double.Parse(textBox2.Text);
d[3]=double.Parse(textBox3.Text);d[4]=double.Parse(textBox4.Text);

for (int i = 1; i <= 3; i++)
	for (int j = i+1; j <= 4; j++)
	{ if (d[i] > d[j])
	{var temp = d[j];d[j] = d[i];d[i] = temp;}
	}

for (int t = 1; t <= 500; t++)
{ textBox5=new TextBox();  
	textBox5.Text = (d[1].ToString()); textBox5.Width = 40;
	textBox5.Location = new System.Drawing.Point(45, 220); 
	this.Controls.Add(textBox5); }
for (int t = 1; t <= 500; t++)
{textBox6=new TextBox();
	textBox6.Text = (d[2].ToString()); textBox6.Width = 40;
	textBox6.Location = new System.Drawing.Point(105, 220);
	this.Controls.Add(textBox6); }
for (int t = 1; t <= 500; t++)
{textBox7=new TextBox();
	textBox7.Text = (d[3].ToString()); textBox7.Width = 40;
	textBox7.Location = new System.Drawing.Point(165, 220);
	this.Controls.Add(textBox7); }
textBox8=new TextBox();
	textBox8.Text = (d[4].ToString()); textBox8.Width = 40;
	textBox8.Location = new System.Drawing.Point(225, 220);
	this.Controls.Add(textBox8); 
}}}


Бегущая строка с востока на запад и наоборот

// dastrun.cs
using System; using System.Text; namespace DAV
{ class Program { static void Main(string[] args) 

{ int ekran = 44; string space = " ";
string ost = "Экспорт Ориентированное Импорто Замещение";
string west = "Export Oriented Replace of Import";
for (int i = 1; i <= ekran+20; i++) {space = space + " ";}

ost = space + ost + space; west = space + west + space; 

for (int i = 1; i <= west.Length-ekran -1; i++)
{ Console.SetCursorPosition(0,2); 
Console.Write(ost.Substring(i, ekran )); 
Console.SetCursorPosition(0,5); 
Console.Write(west.Substring(west.Length-ekran +1-i, ekran )); 
System.Threading.Thread.Sleep(100-ekran);}

Console.ReadKey(); System.Threading.Thread.Sleep(100); }}}


qbasic qb64:

' dastrunqb64.bas

ost$ = "Russian Export Orientirovannoe Importo Zameschenie"
west$ = "Russian Export Oriented Replace of Import"
ekran = 66: s$ = " ": FOR i = 1 TO ekran + 10: s$ = s$ + " ": NEXT

ost$ = s$ + ost$ + s$: west$ = s$ + west$ + s$
ost = LEN(ost$): west = LEN(west$)

FOR i = 1 TO west - ekran
    LOCATE 2, 1: PRINT MID$(ost$, i, ekran)
    LOCATE 5, 1: PRINT MID$(west$, west - ekran + 1 - i, ekran)
    _DELAY (.1 - ekran / 1000)
    ' FOR j = 1 TO 10 ^ 7 - ekran ^ (1.5) * 1 * 10 ^ 4: NEXT
NEXT


image

    ' dastruniq.bas
    ' running strings from ost to west and from left to right
    ' multi-string plus width of screen include in velocity
     
    DIM q$(5): ekran = 66: s$ = " "
    FOR i = 1 TO ekran + 10: s$ = s$ + " ": NEXT
     
    q$(1) = "RRR  U U  SSS  SSS  I   A   N  N    III  QQ  "
    q$(2) = "R R  U U  S    S    I  AAA  NN N     I  Q  Q "
    q$(3) = "RR   U U  SSS  SSS  I  A A  N NN     I  Q  Q "
    q$(4) = "R R  U U    S    S  I  AAA  N  N     I  Q QQ "
    q$(5) = "R R  UUU  SSS  SSS  I  A A  N  N    III  QQ Q"
     
    DIM p$(5), q1, iQ
    FOR i = 1 TO 5: p$(i) = " " + q$(i) + " ": NEXT i: q1 = LEN(p$(1)): iQ = 0
     
    FOR i = 1 TO 5: q$(i) = s$ + q$(i) + s$: NEXT: q = LEN(q$(1))
     
    FOR n = 1 TO 5
        FOR i = 1 TO q - ekran
            FOR j = 1 TO 5
                LOCATE j + 5, 5: COLOR j + i / 15: PRINT MID$(q$(j), i, ekran)
                LOCATE j + 15, 5: COLOR j + i / 22: PRINT MID$(q$(j), q - ekran + 1 - i, ekran)
                GOSUB vertical
    NEXT: _DELAY (.1 - ekran / 3000): NEXT: NEXT
    END
     
    vertical:
    FOR i2 = 1 TO 25
        FOR j2 = 1 TO 5
            COLOR j2 + i2 / 15
            LOCATE i2, (_WIDTH / 2) - 8 + j2
            PRINT MID$(p$(j2), i2 + iQ, 1);
            COLOR j2 + i2 / 22
            LOCATE 26 - i2, (_WIDTH / 2) + 8 - j2
            PRINT MID$(p$(j2), q1 - i2 - iQ, 1);
        NEXT
    NEXT
    _DELAY .1
    IF iQ < q1 THEN iQ = iQ + 1 ELSE iQ = 0
    RETURN


И ещё есть наработки преобразования строк qbasic & c#
нет ли у Вас статистики по поводу того, что применялось чаще — с востока на запад, или наоборот?
5D рельеф создав случайный массив высот
QB64 за 5 минут и плюс за час красота и универсальность

image

' dareliief.bas 
SCREEN 12: RANDOMIZE TIMER: DIM a(12,12)
FOR t=1 TO 12 ' количество 
    FOR x=1 TO 12: FOR y=1 TO 12
a(x,y)=INT(RND*20)'высоты
    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


//daRELIEF.cs
using System; using System.Drawing; using System.Windows.Forms;

class daRELIEF: Form
{ public static void Main() 
{ Application.Run(new daRELIEF());
}
public daRELIEF()
{ Text = "daRELIEF";
BackColor = System.Drawing.Color.Blue;
ForeColor = System.Drawing.Color.Red;
ResizeRedraw = true; Width = 600; Height = 360;
}
	protected override void OnPaint(PaintEventArgs dan)
{ int[,] a = new int[22, 22]; Random rand = new Random();
Graphics da = dan.Graphics;
SolidBrush BlueBrush = new SolidBrush(Color.Blue);

for (int k = 1; k < 22; k++) 
{ for (int x = 1; x <=12; x++)
	for (int y = 1; y <=12; y++)
	a[x,y]=rand.Next(20);

da.FillRectangle(BlueBrush, 20, 20, 550, 300);

	for (int y = 1; y <=12; y++)
	for (int x = 1; x <=11; x++)
da.DrawLine(new Pen(Color.Red, x/2), new Point(50+20*x+20*y, 300-20*y-a[x,y]), new Point(50+20*(x+1)+20*y, 300-20*y-a[x+1,y]));
	
	for (int x = 1; x <=12; x++)
	for (int y = 1; y <=11; y++)
da.DrawLine(new Pen(Color.Red, y/2), new Point(50+20*x+20*y, 300-20*y-a[x, y]), new Point(50+20*(x+1)+20*y, 300-20*(y+1)-a[x, y+1]));

System.Threading.Thread.Sleep(1000);
	Array.Clear(a, 0, 22);
}}}

image

Вычислить длины линий легко используя функцию корень из квадратного уравнения

Некоторые программы без форматирования в теме из-за css вместо java получше

Конструкция if then else рассмотрена в начале темы

Приветствую перевод простых программ на другие языки программирования

http://rosettacode.org/wiki/Category:C_sharp

http://rosettacode.org/wiki/Category:QB64

http://rosettacode.org/wiki/Category:QBasic
Осваиваю элементы управления и некоторые похожие изучаю за минуту
вписывая только строки в программу в блокнот без оболочек и без помощи

Справочники показывают на что из сделанного похож очередной изучаемый элемент
и в некоторых эл. книгах пишут не про все управляющие

И пока вводимые данные не используются

image

// ELEMENTS.cs
// csc.exe /target:winexe ELEMENTS.cs
// pause
using System; using System.IO;
using System.Drawing; using System.Diagnostics;
using System.Windows.Forms; namespace ELEMENTS
{
	public class Program

{static void Main()
{Application.Run(new ELEMENTS());}}
	class ELEMENTS : Form 
	{
ComboBox comboBox1; TextBox textBox1, textBox2; 
CheckBox checkBox41, checkBox42; Button button1; 
RadioButton radioButton31, radioButton32, radioButton33;
Label label1, label2, label3, label31, label33; 
Label label4, label41, label42, label5, label6; ListBox listBox5; 
CheckedListBox checkedlistBox6;

	public ELEMENTS()

{ Text = "ELEMENTS"; BackColor = SystemColors.WindowText;
ForeColor = SystemColors.Window; 
ResizeRedraw = true; Width = 480; Height = 240; }

	protected override void OnPaint(PaintEventArgs dan)
	{

comboBox1 = new ComboBox(); 
	comboBox1.Location = new Point(10, 50); comboBox1.Width = 40;
	comboBox1.Items.AddRange(new string[] {"3","2","1","4","5","6"});
	comboBox1.SelectedIndex = 2; comboBox1.BackColor = Color.Red;

textBox2=new TextBox(); textBox2.Text = "2"; textBox2.Width = 20;
textBox2.Location = new Point(70, 50); textBox2.BackColor = Color.Orange;

radioButton31 = new RadioButton(); radioButton31.Location = new Point(170, 50);
	radioButton31.Checked = true; radioButton31.Width = 20;
radioButton32 = new RadioButton(); radioButton32.Location = new Point(150, 70);
	radioButton32.Checked = false; radioButton32.Width = 20;
radioButton33 = new RadioButton(); radioButton33.Location = new Point(130, 90);
	radioButton33.Checked = false; radioButton33.Width = 20;
radioButton33.BackColor = Color.Yellow;

checkBox41 = new CheckBox(); checkBox41.Location = new Point(220, 50);
checkBox41.Checked = true; checkBox41.Width = 20;
checkBox42 = new CheckBox(); checkBox42.Location = new Point(200, 70);
checkBox42.Checked = false; checkBox42.Width = 20;
checkBox42.BackColor = Color.Green; // checkBox42.Appearance = 1; // true

listBox5 = new ListBox(); listBox5.Location = new Point(280, 50);
listBox5.Items.AddRange(new string[] {"6","5","4","1","2","3"}); 
listBox5.Width = 40; listBox5.SelectedIndex = 1; listBox5.BackColor = Color.Blue;

checkedlistBox6 = new CheckedListBox(); checkedlistBox6.Location = new Point(360, 50);
checkedlistBox6.Items.AddRange(new string[] {"1","3","5","2","4","6"}); 
checkedlistBox6.Width = 40; checkedlistBox6.SelectedIndex = 5; 
checkedlistBox6.BackColor = Color.Magenta;

label1 = new Label(); label1.Text = "comboBox";
	label1.Location = new Point(10, 20); label1.Width = 60;
label2 = new Label(); label2.Text = "textBox";
	label2.Location = new Point(70, 20); label2.Width = 60;

label3 = new Label(); label3.Text = "radioButton";
	label3.Location = new Point(130, 20); label3.Width = 80;
label31 = new Label(); label31.Text = "31";
	label31.Location = new Point(130, 50); label31.Width = 20;
label33 = new Label(); label33.Text = "33";
	label33.Location = new Point(170, 90); label33.Width = 20;

label4 = new Label(); label4.Text = "checkBox";
	label4.Location = new Point(210, 20); label4.Width = 60;
label41 = new Label(); label41.Text = "41";
	label41.Location = new Point(240, 53); label41.Width = 20;
label42 = new Label(); label42.Text = "42";
	label42.Location = new Point(230, 78); label42.Width = 20;

label5 = new Label(); label5.Text = "listBox";
	label5.Location = new Point(280, 20); label5.Width = 60;
label6 = new Label(); label6.Text = "checkedlistBox";
	label6.Location = new Point(360, 20); label6.Width = 100;

Controls.Add(comboBox1); Controls.Add(textBox2); Controls.Add(listBox5); 
Controls.Add(checkBox41); Controls.Add(checkBox42); Controls.Add(radioButton31); 
Controls.Add(radioButton32); Controls.Add(radioButton33); 
Controls.Add(checkedlistBox6); 

Controls.Add(label1); Controls.Add(label2); Controls.Add(label3); 
Controls.Add(label4); Controls.Add(label41); Controls.Add(label42); 
Controls.Add(label31); Controls.Add(label33); Controls.Add(label5);
Controls.Add(label6);

button1 = new Button();	button1.Click+=button1_Click;
	button1.Location = new System.Drawing.Point(10, 80);
	button1.Width = 80; button1.Text = "Переставить";

Controls.Add(button1); 
	}

private void button1_Click(object sender, EventArgs e)
	{ 

textBox1=new TextBox(); textBox1.Text = listBox5.Text; 
textBox1.Width = 40;
	textBox1.Location = new Point(10, 120);
Controls.Add(textBox1);
}}}
Сортировка обратного массива перетасовывает прямой массив
и получается последовательность нормальная

'datasov.bas
DIM a(55000), d(55000)
OPEN "aa.txt" FOR INPUT AS #1
OPEN "dd.txt" FOR OUTPUT AS #2

FOR i = 1 TO 55000
    INPUT #1, a(i): d(55000 - i + 1) = a(i):NEXT

FOR i = 1 TO 54999: FOR j = i TO 55000
        IF d(i) > d(j) THEN SWAP d(i), d(j): SWAP a(i), a(j)
NEXT: NEXT

FOR i = 1 TO 55000: PRINT #2, a(i): NEXT: CLOSE


Без применения спец возможностей сортировки связанных массивов
главное соблюдая совместимость qbasic & qb64 & c#

//datasov.cs
using System; using System.Linq;
using System.Collections.Generic;
using System.Text; using System.IO;
namespace tasov
{ class Program
    { static long[] a; static long[] d;
        static void Main(string[] args)
        {a = new long[55500]; d = new long[55500]; 
var inpFile = new StreamReader("aa.txt");
for (int i = 1; i <= 55000; i++) 
{ a[i] = Convert.ToInt64(inpFile.ReadLine());
d[55000-i+1] = a[i]; }

for (int i = 1; i <= 54999; i++) 
for (int j = i; j <= 55000; j++) 
if (d[i] > d[j])
{ var temp = d[i]; d[i] = d[j]; d[j] = temp;
temp = a[i]; a[i] = a[j]; a[j] = temp; }

var outFile = new StreamWriter("vv.txt");
for (int i = 1; i <= 55000; i++) 
outFile.WriteLine(a[i]);
Console.ReadKey();}}}


Программы импортируют и экспортируют
Программа распределения случайных на спектры количества подряд одинаковых признаков меньше \ больше и чётный \ нечётный

Program for distribution spectra of random number of consecutive identical features less \ more and even \ odd

'datable99.bas

RANDOMIZE TIMER
tb=TIMER: s=0
OPEN "zz99.txt" FOR OUTPUT AS #2
n=VAL(MID$(TIME$, 7, 2)) * 10 ^ 5
DIM b(n), d(n), e(n), f(n)
DIM j(n), k(n), m(n), p(16), q(16)
LOCATE 1, 1: PRINT " THEORY        Average       BIG           EVEN "

FOR i=2 TO n-1
    b(i)=INT(RND * 900) + 100: s=s + b(i): m=s/i

    IF b(i) < m THEN d(i)=0 ELSE d(i)=1
    IF (b(i) MOD 2)=0 THEN j(i)=0 ELSE j(i)=1

    IF d(i)=d(i-1) THEN e(i)=e(i-1) + 1 ELSE e(i)=0
    IF e(i)=0 THEN f(i)=e(i-1) ELSE f(i)=12
    IF f(i) > 12 THEN f(i)=12

    IF j(i)=j(i-1) THEN k(i)=k(i-1) + 1 ELSE k(i)=0
    IF k(i)=0 THEN m(i)=k(i-1) ELSE m(i)=12
    IF m(i) > 12 THEN m(i)=12

    p(f(i))=p(f(i)) + 1: q(m(i))=q(m(i)) + 1

    IF (i MOD 1000)=0 THEN LOCATE 3, 1: PRINT i, " from ", n, INT(100 * i/n); " %", 
NEXT

LOCATE 3, 1: FOR t=1 TO 12
    PRINT INT(n/(2 ^ (t + 1))), INT((p(t-1) + q(t-1))/2), p(t-1), q(t-1)
NEXT

te=TIMER
PRINT: PRINT te-tb; "second", INT(n/(te-tb)); " in second  "
PRINT n, " elements ",

PRINT #2, te-tb; "second", INT(n/(te-tb)); " in second  "
PRINT #2, n, " elements ",: PRINT #2,

PRINT #2,: PRINT #2, " THEORY        Average       BIG           EVEN ": PRINT #2,
FOR t=1 TO 12
    PRINT #2, INT(n/(2^(t + 1))), INT((p(t-1) + q(t-1))/2), p(t-1), q(t-1)
NEXT

Особенность программы: индексы индексов p(f(i)) & q(m(i))
Feature of program: index of indixes p(f(i)) & q(m(i))

Результаты Results:
40 second             139555  in second  
 5600000       elements     

 Теория        Среднее       Большие       Чётные
 THEORY        Average       BIG           EVEN 

 1400000       1400610       1399595       1401625 
 700000        700026        700122        699931 
 350000        349716        349508        349925 
 175000        174823        174892        174755 
 87500         87424         87564         87285 
 43750         43837         43931         43744 
 21875         22028         21983         22074 
 10937         10850         10865         10835 
 5468          5481          5496          5466 
 2734          2755          2732          2778 
 1367          1388          1396          1380 
 687           687           687           687 


Practical distributions correspond to theoretical ones
so random sequence is qualitative
and it is possible to study patterns of different sequences

Binomial Logarithmic Integral Pyramidal Distribution
BLIP distribution of Random numbers

I think random have problems with parity:
parity of random changes too sharply

Практические распределения соответствуют теоретическим
значит случайная последовательность качественная
и возможно изучить паттерны различных последовательностей

Биномиальное Логарифмическое Интегральное Пирамидальное распределение
БЛИП распределение случайных чисел

Думаю у случайных проблемы с чётностью:
слишком резко меняется чётность случайных
))))))
у Вас врожденное чувство такта )
И это только шестой день карантина…

К концу карантина появится новая TempleOS… с названием КремльОС или МавзолейОС? :-)

Экспорт Ориентированная Импорт Замещающая
моя программа про числа Фибоначчи Fibonacci numbers

'Fibo78.bas
DIM F(80) AS DOUBLE
F(1) = 0: F(2) = 1
'OPEN "fibo78.txt" FOR OUTPUT AS #1
FOR i = 3 TO 80
    F(i) = F(i-1)+F(i-2)
NEXT i

FOR i = 1 TO 80
    f$ = STR$(F(i)): LF = 22 - LEN(f$)
    n$ = ""
    FOR j = 1 TO LF: n$ = " " + n$: NEXT
    f$ = n$ + f$
    PRINT i, f$: ' PRINT #1, i, f$
NEXT i

1                                 0
2                                 1
3                                 1
4                                 2
5                                 3
6                                 5
7                                 8
8                                13
9                                21
10                               34
11                               55
12                               89
13                              144
14                              233
15                              377
16                              610
17                              987
18                             1597
19                             2584
20                             4181
21                             6765
22                            10946
23                            17711
24                            28657
25                            46368
26                            75025
27                           121393
28                           196418
29                           317811
30                           514229
31                           832040
32                          1346269
33                          2178309
34                          3524578
35                          5702887
36                          9227465
37                         14930352
38                         24157817
39                         39088169
40                         63245986
41                        102334155
42                        165580141
43                        267914296
44                        433494437
45                        701408733
46                       1134903170
47                       1836311903
48                       2971215073
49                       4807526976
50                       7778742049
51                      12586269025
52                      20365011074
53                      32951280099
54                      53316291173
55                      86267571272
56                     139583862445
57                     225851433717
58                     365435296162
59                     591286729879
60                     956722026041
61                    1548008755920
62                    2504730781961
63                    4052739537881
64                    6557470319842
65                   10610209857723
66                   17167680177565
67                   27777890035288
68                   44945570212853
69                   72723460248141
70                  117669030460994
71                  190392490709135
72                  308061521170129
73                  498454011879264
74                  806515533049393
75                 1304969544928657
76                 2111485077978050
77                 3416454622906707
78                 5527939700884757
79                 8944394323791464
80            1.447233402467622D+16

rosettacode.org/wiki/Fibonacci_sequence
https://qb64.org/forum/

image

Еженедельно скачиваю ютюб монологи и диалоги экономя мегабайты
без скачивания аудио-дорожки:

Открываю нужный ютюб вида говорящая голова
Перематываю ютюб в конец и останавливаю экономя мегабайты

Вижу 3 точки и жму «Посмотреть расшифровку видео»
Появляется справа «Расшифровка видео»
Вверху 3 точки и жму «Показать или скрыть временные метки»
Отключаю столбец цифр
Курсором выделяю текст и копирую

В блокнот вставляю и сохраняю с понятным именем
Обычно далее озвучиваю через синтезатор речи

Итого: запасено 50 часов неважно чьих статей и ютюбов

Прослушиваю без эмоциональной привязки главное… бесплатно

Данный способ наверняка подходит для преобразования аудио в текст закачав ютюб
Проверка Wolframalpha: надёжность выиграть и проиграть
и вероятность выигрыша и проигрыша создают 4 комбинации:
C+p^N=1… (1-C)+p^N=1… C+(1-p)^N=1… (1-C)+(1-p)^N=1

Причём всё взаимозаменяемо:
C=1-c… c=1-C… P=1-p… p=1-P

Искусственный интеллект Wolframalpha знает логарифм:
solve C+(1-p)^N=1 for N

wolframalpha.com/input/?i=solve+C%2B%281-p%29%5EN%3D1+for+N



Checking in Wolframalpha: reliability win and lose
both probability of winning and losing create 4 combinations:
C+p^N=1… (1-C)+p^N=1… C+(1-p)^N=1… (1-C)+(1-p)^N=1

Everything is interchangeable:
C=1-c… c=1-C… P=1-p… p=1-P

Artificial intelligence of Wolframalpha knows logarithm:
solve C+(1-p)^N=1 for N

wolframalpha.com/input/?i=solve+C%2B%281-p%29%5EN%3D1+for+N

image
Исследуя стили оформления скобок { } C#
были скачаны 33 темы разных лет про C#
из них 8 страниц без программ текстами

25 страниц содержали листинги 60 программ и включались в счётчик
учитывая принцип количества программ на странице

90% мой стиль: скобка в начале строки в начале строки скобка в начале строки 90 %
10% неудобный принцип: скобка иначе 10 %

Подтверждается дюжинами тем начинающих
программирующих как Мы на других форумах

Вдвойне удивительно видя токсичное агрессивное меньшинство 10%-х
и дружелюбное большинство программирующих как Мы 90%: скобка в начале
— Холмс откуда вы точно узнали кто все 6-ро
ставящие вам минусы анонимно исподтишка?

— Элементарно: накануне минусовавшего 7-го
самого анонимно исподтишка заминусовали
Sign up to leave a comment.

Articles