i made this UI it works fine , but i cant make it with the OUT parameter in the arrayMath method
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ArrayManagementGUI
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
double[] myArray = new double[8];
private void button1_Click(object sender, EventArgs e)
{
myArray[0] = Convert.ToDouble(textBox1.Text);
myArray[1] = Convert.ToDouble(textBox2.Text);
myArray[2] = Convert.ToDouble(textBox3.Text);
myArray[3] = Convert.ToDouble(textBox4.Text);
myArray[4] = Convert.ToDouble(textBox5.Text);
myArray[5] = Convert.ToDouble(textBox6.Text);
myArray[6] = Convert.ToDouble(textBox7.Text);
myArray[7] = Convert.ToDouble(textBox8.Text);
arrayMath(myArray);
displayArray(myArray);
}
public void arrayMath(double [] myArray)
{
double sum = myArray.Sum();
double avg = myArray.Average();
label2.Text = "The Sum is: " + sum + "\n" + "The Average is: " + avg + "\n";
}
public void displayArray(double[] myArray)
{
foreach (double d in myArray)
{
label2.Text += "\t\t " +d.ToString();
}
}
}
}