static void CheckIndexMass() { MyFunctions.PersonStruct person = new MyFunctions.PersonStruct { height = MyFunctions.GetDouble("Введите ваш рост(см): ", false, 0.5, 0, true), weight = MyFunctions.GetDouble("Введите ваш вес(кг): ", false, 0.5, 0, true), }; person.indexMass = MyFunctions.GetIndexMass(person); Console.Write($"Индекс массы тела - {person.indexMass:f1}. "); if (person.indexMass < 18.5) { Console.WriteLine($"Ваш вес ниже нормального!"); } else if (person.indexMass >= 18.5 && person.indexMass < 25) { Console.WriteLine($"Ваш вес нормальный!"); } else if (person.indexMass >= 25 && person.indexMass < 30) { Console.WriteLine($"Ваш вес избыточный!"); } else if (person.indexMass >= 30 && person.indexMass < 35) { Console.WriteLine($"У вас ожирение I степени!"); } else if (person.indexMass >= 35 && person.indexMass < 40) { Console.WriteLine($"У вас ожирение II степени!"); } else if (person.indexMass >= 40) { Console.WriteLine($"У вас ожирение III степени!"); } if (person.indexMass < 18.5) { Console.WriteLine($"Вам необходимо набрать {MyFunctions.GetMassFromGreatIndex(person, 18.5) - person.weight:f1} кг."); } else if (person.indexMass > 25) { Console.WriteLine($"Вам необходимо сбросить {person.weight - MyFunctions.GetMassFromGreatIndex(person, 25):f1} кг."); } }
// #region Задание №1 static MyFunctions.PersonStruct HelloMan(bool printResult = true) { MyFunctions.PersonStruct person = new MyFunctions.PersonStruct { name = MyFunctions.GetString("Введите ваше имя: "), surName = MyFunctions.GetString("Введите вашу фамилию: "), years = MyFunctions.GetDouble("Введите ваш возраст(лет): ", false, 0.5, 0, true), height = MyFunctions.GetDouble("Введите ваш рост(см): ", false, 0.5, 0, true), weight = MyFunctions.GetDouble("Введите ваш вес(кг): ", false, 0.5, 0, true) }; if (printResult == true) { Console.WriteLine($"Здравствуй, {person.surName}, {person.name}! Ваш вес - {person.weight:f2} кг., при росте - {person.height:f2} см. и возрасте {person.years:f1} лет!"); } return(person); }
static void IndexMassMan() { MyFunctions.PersonStruct person = HelloMan(false); person.indexMass = MyFunctions.GetIndexMass(person); Console.WriteLine($"Здравствуй, {person.surName}, {person.name}! Ваш индекс массы тела - {(person.indexMass):f2} при весе - {person.weight:f2} кг. и росте - {person.height:f2} см.!"); }