2012-10-07 2 views
-1

attendu que je suis nouveau à C# .Je essayé d'écrire calculator.I moyenne de base obtiennent 60 erreurs plupart d'entre euxponctuation erreurs C#

) prévu

;

J'ai vérifié mais je pense que tout est correct. Puis-je avoir un problème à propos de ce que j'utilise 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"; 
       } 


     } 



     } 
+3

" "; ..? Que font ces choses là? – Thousand

+0

Avez-vous copié/collé ce code sur le Web? –

+0

oui ı copié du web – allstar

Répondre

2

Vous avez des entités HTML dans le code que vous devez convertir en caractères réels.

Ce par exemple:

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

devrait être:

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

merci beaucoup – allstar

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"; 
}