-2

I am new to c#.I trıed to write basic average calculator.I get 60 error most of them

) expected

; expected

I checked but i think everythıng s correct.Can it be problem about that I use visual studio 2010?

using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace WindowsFormsApplication3
    {

            public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }

            private void button1_Click(object sender, EventArgs e)
            {
                double a;
                a = ((Convert.ToInt16(textBox1.Text) * 0.4) + (Convert.ToInt16(textBox2.Text) * 0.6));
                if (a >= 50 & a < 60 & Convert.ToInt64(textBox2.Text) >= 50)
                {
                    label4.Text = "Geçti";
                    label5.Text = "CC";
                    textBox3.Text = a.ToString();
                }

                else
                {
                    label4.Text = "KALDI";
                    label5.Text = "FF";
                    textBox3.Text = a.ToString();            
                }

            }



                private void button2_Click_1(object sender, EventArgs e)
                {
                textBox1.Text = "";
                textBox2.Text = "";
                textBox3.Text = "";
                label4.Text = "Durum";
                label5.Text = "Sonuc";
                }


        }



        }
allstar
  • 109
  • 3
  • 12

2 Answers2

2

You have HTML entities in the code, which you would have to convert back to real characters.

This for example:

if (a >= 50 & a < 60 & Convert.ToInt64(textBox2.Text) >= 50)

should be:

if (a >= 50 & a < 60 & Convert.ToInt64(textBox2.Text) >= 50)
Guffa
  • 687,336
  • 108
  • 737
  • 1,005
0
private void button1_Click(object sender, EventArgs e)
{
    double a;
    a = ((Convert.ToInt16(textBox1.Text) * 0.4) + (Convert.ToInt16(textBox2.Text) * 0.6));
    if (a >= 50 && a < 60 && Convert.ToInt64(textBox2.Text) >= 50)
    {
        label4.Text = "Ge&ccedil;ti";
        label5.Text = "CC";
        textBox3.Text = a.ToString();
    }
    else
    {
        label4.Text = "KALDI";
        label5.Text = "FF";
        textBox3.Text = a.ToString();            
    }
}

private void button2_Click_1(object sender, EventArgs e)
{
    textBox1.Text = "";
    textBox2.Text = "";
    textBox3.Text = "";
    label4.Text = "Durum";
    label5.Text = "Sonuc";
}
Furqan Safdar
  • 16,260
  • 13
  • 59
  • 93