Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
ПЗ_гр.220201_МихайловА.Д. варNo.20_ver_1.0.6.docx
Скачиваний:
0
Добавлен:
01.03.2025
Размер:
1.48 Mб
Скачать

Файл Default.Aspx.Cs

using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using TP3.localhost;

namespace TP3

{

public partial class _Default : System.Web.UI.Page

{

Service proxy = new Service();

protected void Page_Load(object sender, EventArgs e)

{

}

protected void RadioButton1_CheckedChanged(object sender, EventArgs e)

{

}

protected void RadioButton2_CheckedChanged(object sender, EventArgs e)

{

Random RandPoint = new Random();

double ax,ay,bx,by,cx,dx;

ax = RandPoint.Next(0,20);

ay = RandPoint.Next(0, 30);

bx = RandPoint.Next(10, 30) + ax;

by = RandPoint.Next(10, 40) + ay;

cx = RandPoint.Next(10, 20) + bx;

dx = RandPoint.Next(10, 30) + cx;

TextBox1.Text = ax.ToString();

TextBox2.Text = bx.ToString();

TextBox3.Text = cx.ToString();

TextBox4.Text = dx.ToString();

TextBox5.Text = ay.ToString();

TextBox6.Text = by.ToString();

TextBox7.Text = by.ToString();

TextBox8.Text = ay.ToString();

}

protected void RadioButton3_CheckedChanged(object sender, EventArgs e)

{

TextBox1.Text = "100";

TextBox2.Text = "200";

TextBox3.Text = "300";

TextBox4.Text = "400";

TextBox5.Text = "100";

TextBox6.Text = "200";

TextBox7.Text = "200";

TextBox8.Text = "100";

}

protected void Button1_Click(object sender, EventArgs e)

{

double ax, ay, bx, by, cx, cy, dx, dy;

ax = double.Parse(TextBox1.Text);

bx = double.Parse(TextBox2.Text);

cx = double.Parse(TextBox3.Text);

dx = double.Parse(TextBox4.Text);

ay = double.Parse(TextBox5.Text);

by = double.Parse(TextBox6.Text);

cy = double.Parse(TextBox7.Text);

dy = double.Parse(TextBox8.Text);

if (ax < bx && bx < cx && cx < dx && ay == dy && by == cy)

{

Label31.Visible = true;

Label32.Visible = true;

Label33.Visible = true;

Label34.Visible = true;

Label35.Visible = true;

Label36.Visible = true;

double[] mas = new double[6];

mas = proxy.montecarlo(ax, ay, bx, by, cx, cy, dx, dy, 1000);

Label1.Text = mas[0].ToString();

Label2.Text = mas[1].ToString();

Label3.Text = mas[2].ToString();

Label4.Text = mas[3].ToString();

Label5.Text = mas[4].ToString();

Label6.Text = mas[5].ToString();

mas = proxy.montecarlo(ax, ay, bx, by, cx, cy, dx, dy, 10000);

Label7.Text = mas[0].ToString();

Label8.Text = mas[1].ToString();

Label9.Text = mas[2].ToString();

Label10.Text = mas[3].ToString();

Label11.Text = mas[4].ToString();

Label12.Text = mas[5].ToString();

mas = proxy.montecarlo(ax, ay, bx, by, cx, cy, dx, dy, 100000);

Label13.Text = mas[0].ToString();

Label14.Text = mas[1].ToString();

Label15.Text = mas[2].ToString();

Label16.Text = mas[3].ToString();

Label17.Text = mas[4].ToString();

Label18.Text = mas[5].ToString();

mas = proxy.montecarlo(ax, ay, bx, by, cx, cy, dx, dy, 1000000);

Label19.Text = mas[0].ToString();

Label20.Text = mas[1].ToString();

Label21.Text = mas[2].ToString();

Label22.Text = mas[3].ToString();

Label23.Text = mas[4].ToString();

Label24.Text = mas[5].ToString();

mas = proxy.montecarlo(ax, ay, bx, by, cx, cy, dx, dy, 10000000);

Label25.Text = mas[0].ToString();

Label26.Text = mas[1].ToString();

Label27.Text = mas[2].ToString();

Label28.Text = mas[3].ToString();

Label29.Text = mas[4].ToString();

Label30.Text = mas[5].ToString();

}

else

{

Response.Write("Ошибка при вводе данных, попробуйте еще раз.");

}

}

}

}

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]