All the examples I find use a foreach loop. Prior to adding the other 2 classes I used a foreach loop fine, but now I got to get the indexing to work right. Any suggestions?
static void Main(string[] args)
{
DataTable table = new DataTable("IrisTrainingData");
table.Columns.Add("SepalLength", typeof(double));
table.Columns.Add("SepalWidth", typeof(double));
table.Columns.Add("PedalLength", typeof(double));
table.Columns.Add("PedalWidth", typeof(double));
table.Columns.Add("Class", typeof(double));
table.Rows.Add(5.1, 3.5, 1.4, 0.2, 1);
table.Rows.Add(4.9, 3.0, 1.4, 0.2, 1);
table.Rows.Add(4.7, 3.2, 1.3, 0.2, 1);
table.Rows.Add(4.6, 3.1, 1.5, 0.2, 1);
table.Rows.Add(5.0, 3.6, 1.4, 0.2, 1);
table.Rows.Add(5.4, 3.9, 1.7, 0.4, 1);
table.Rows.Add(4.6, 3.4, 1.4, 0.3, 1);
table.Rows.Add(5.0, 3.4, 1.5, 0.2, 1);
table.Rows.Add(4.4, 2.9, 1.4, 0.2, 1);
table.Rows.Add(4.9, 3.1, 1.5, 0.1, 1);
table.Rows.Add(5.4, 3.7, 1.5, 0.2, 1);
table.Rows.Add(4.8, 3.4, 1.6, 0.2, 1);
table.Rows.Add(4.8, 3.0, 1.4, 0.1, 1);
table.Rows.Add(4.3, 3.0, 1.1, 0.1, 1);
table.Rows.Add(5.8, 4.0, 1.2, 0.2, 1);
table.Rows.Add(5.7, 4.4, 1.5, 0.4, 1);
table.Rows.Add(5.4, 3.9, 1.3, 0.4, 1);
table.Rows.Add(5.1, 3.5, 1.4, 0.3, 1);
table.Rows.Add(5.7, 3.8, 1.7, 0.3, 1);
table.Rows.Add(5.1, 3.8, 1.5, 0.3, 1);
table.Rows.Add(5.4, 3.4, 1.7, 0.2, 1);
table.Rows.Add(5.1, 3.7, 1.5, 0.4, 1);
table.Rows.Add(4.6, 3.6, 1.0, 0.2, 1);
table.Rows.Add(5.1, 3.3, 1.7, 0.5, 1);
table.Rows.Add(4.8, 3.4, 1.9, 0.2, 1);
double total1 = 0.0;
double total2=0.0;
double total3=0.0;
double total4=0.0;
for (int i = 0; i < 25; i++)
{
total1 += table.Rows[i]["SepalLength"]; <- I know this is wrong
total2 += (double)row["SepalWidth"];
total3 += (double)row["PedalLength"];
total4 += (double)row["PedalWidth"];
}