Error at making a conversor of celsius to Fahrenheint, got a lot of errors

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jr014
    New Member
    • Aug 2014
    • 1

    Error at making a conversor of celsius to Fahrenheint, got a lot of errors

    Hey guys Iam quite new at programming
    I was making a conversor of Celsius to Fahrenheint , then i got a lot of errors

    i don`t know if my logic is wrong or just the code

    could someone help me ??


    Code:
            private void button1_Click(object sender, EventArgs e)
            {
             double celsius, fare = 0;
    
    
                if (txtCelsius.Text == "") ;
                    
                    {
                        celsius = (Convert.ToDouble(txtFahrenheint.Text) / 1.8) + 32;
                        txtCelsius.Text = Convert.ToString(celsius);
                    }
                
                else if (txtFahrenheint.Text == "");
                     {
                             fare = (Convert.ToDouble(txtCelsius.Text) * 1.8) + 32;
                             txtFahrenheint.Text = Convert.ToString(fare);
                     }
    
           else;
                {
    
                    Console.WriteLine ("Valor incorreto");
                }
                
    
            }
    Last edited by Rabbit; Aug 15 '14, 10:30 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • horace1
    Recognized Expert Top Contributor
    • Nov 2006
    • 1510

    #2
    try removing the ; from the end of the statements
    Code:
    if (txtCelsius.Text == "") ;
    and
    Code:
                 else if (txtFahrenheint.Text == "");
    and
    Code:
           else;

    Comment

    Working...