Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- using System.Collections;
- using System.IO;
- namespace _15._42
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Dialog_Click(object sender, EventArgs e)
- {
- openFileDialog1.ShowDialog();
- way.Text = openFileDialog1.FileName;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Queue<Double> q1 = new Queue<Double>();
- StreamReader st = new StreamReader(way.Text);
- string[] arr = null;
- while (!st.EndOfStream)
- {
- string line = st.ReadLine();
- arr = line.Split('\n');
- for (int i = 0; i < arr.Length; i++)
- {
- Double prover;
- if (Double.TryParse(arr[i], out prover))
- q1.Enqueue(prover);
- }
- }
- st.Close();
- int n = q1.Count;
- Double[] A = new Double[n];
- for (int i = 0; i < n; i++)
- {
- A[i] = q1.Dequeue();
- }
- Double s = 1;
- int j = n;
- for (int i = 0; i != n - 2; i++)
- {
- s = s * (A[i] + A[i + 1] + 2 * A[j]);
- j--;
- }
- result.Text += " " + Convert.ToString(s);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement