-2
我在C#中有一個價格計算代碼。計算所有價格和稅金的具體順序如何應用模糊邏輯,以便我可以獲得該特定價格的相關搜索。這意味着如果其中一個稅名是'cost/kg'.So I should get all of the name of prices or prices which start of C or CO。價格計算的模糊邏輯
我在C#中有一個價格計算代碼。計算所有價格和稅金的具體順序如何應用模糊邏輯,以便我可以獲得該特定價格的相關搜索。這意味着如果其中一個稅名是'cost/kg'.So I should get all of the name of prices or prices which start of C or CO。價格計算的模糊邏輯
一個簡單的方法是將價格限制在某些最小/最大範圍內搜索
double k = 0.1;
double min = searchedAmount - (searchedAmount * k);
double max = searchedAmount + (searchedAmount * k);
var results = products.Where(p => p.Price >= min && p.Price <= max);
這個問題很含糊,也許顯示一些你已經試過的東西,一些示例數據和需要的輸出等。 –