تابعی ایجاد کنید تا لیستی از درصدها را به معادل اعشاری آنها تبدیل کند.
نمونه ورودی و خروجی
ConvertToDecimal(["1%", "2%", "3%"]) ➞ [0.01, 0.02, 0.03]
ConvertToDecimal(["45%", "32%", "97%", "33%"]) ➞ [0.45, 0.32, 0.97, 0.33]
ConvertToDecimal(["33%", "98.1%", "56.44%", "100%"]) ➞ [0.33, 0.981, 0.5644, 1]
EXPECT_EQ(ConvertToDecimal({"1%", "2%", "3%"}), std::vector({0.01f, 0.02f, 0.03f})); EXPECT_EQ(ConvertToDecimal({"45%", "32%", "97%", "33%"}), std::vector ({0.45f, 0.32f, 0.97f, 0.33f})); EXPECT_EQ(ConvertToDecimal({"33%", "98.1%", "56.44%", "100%"}), std::vector ({0.33f, 0.981f, 0.5644f, 1.0f}));
نظرات