이 요소의 가장 가까운 값 사이의 범위를 찾고 싶습니다. 요소 사이의 델타 값입니다. 그리고 그것의 계수 때문에 양수 일 것입니다.배열의 각 요소에 가장 가까운 값을 찾는 방법은 무엇입니까?
class Element {
double DeltaValue;
double ElementValue;
public Element(double n) {
ElementValue = n;
}
static void Main() {
list<Element> ListElements = new list<Elements>;
ListElements.Add(3);
ListElements.Add(10);
ListElements.Add(43);
ListElements.Add(100);
ListElements.Add(30);
ListElements.Add(140);
for(int i = 0; i < ListElements.Count; i++) {
ListElements[i].DeltaValue = //and problem is here
//example as for ListElements[2].DeltaValue will be 13; because 43-30=13;
}
// 예제는 ListElements [2]와 같습니다 .DeltaValue는 13입니다. 43-30 = 13이기 때문에;
배열 정렬에 대해 생각해 보셨습니까? –
@ Sidias-Korrado 잘 아니요. 전에는 사용하지 못했습니다. – ldn