försökt hitta extremer

This commit is contained in:
2018-12-16 12:18:03 +01:00
parent c6c465c82e
commit 8fd223686e

View File

@ -23,12 +23,31 @@ namespace _2018_06
}
int points = 0;
foreach(Tuple<int,int> tp in koords)
int al = 999+999, bl = 0;
int a1=999, a2 = 999;
int b1 = 0, b2 = 0;
foreach (Tuple<int,int> tp in koords)
{
points++;
WriteLine($"point {points}, X: {tp.Item1} Y: {tp.Item2}");
if (tp.Item1 + tp.Item2 < al)
{
a1 = tp.Item1;
a2 = tp.Item2;
}
if (tp.Item1 + tp.Item2 > bl)
{
b1 = tp.Item1;
b2 = tp.Item2;
}
}
WriteLine($"low value: {a1},{a2} high value: {b1},{b2}");
ReadKey();
}
}
}