Esempio n. 1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            double DegText, CelText;

            DegText     = double.Parse(textBox1.Text);
            CelText     = (5.0 / 9.0) * (DegText - 32.0);
            label2.Text = "It is " + CelText.ToString() + " degrees in Celsius.";

            if (DegText > 100)
            {
                label3.Text = "It's Hot! Better Hydrate";
            }
            else if (DegText <= 32)
            {
                label3.Text = "It's Cold! Better pack long underwear";
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter a valid Fahrenheit temperature.");
            string strDegText = Console.ReadLine();
            double DegText, CelText;

            DegText = double.Parse(strDegText);
            CelText = (5.0 / 9.0) * (DegText - 32.0);
            Console.WriteLine("It is " + CelText.ToString() + " degrees in Celsius.");

            if (DegText > 100)
            {
                Console.WriteLine("It's Hot! Better Hydrate");
            }
            else if (DegText <= 32)
            {
                Console.WriteLine("It's Cold! Better pack long underwear");
            }
            Console.ReadLine();
        }