标点符号预期错误-c#
我是c#的新手。我试着写一个基本的平均值计算器。大多数我都有60个错误 )期望 );期望 我检查过了,但我认为一切都是正确的。我使用VisualStudio2010会有问题吗标点符号预期错误-c#,c#,punctuation,C#,Punctuation,我是c#的新手。我试着写一个基本的平均值计算器。大多数我都有60个错误 )期望 );期望 我检查过了,但我认为一切都是正确的。我使用VisualStudio2010会有问题吗 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; u
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";
}
}
}
代码中有HTML实体,必须将其转换回实际字符 例如:
if (a >= 50 & a < 60 & Convert.ToInt64(textBox2.Text) >= 50)
应该是:
if (a >= 50 & a < 60 & Convert.ToInt64(textBox2.Text) >= 50)
if(a>=50&a<60&Convert.ToInt64(textBox2.Text)>=50)
私有无效按钮1\u单击(对象发送者,事件参数e)
{
双a;
a=((Convert.ToInt16(textBox1.Text)*0.4)+(Convert.ToInt16(textBox2.Text)*0.6));
如果(a>=50&&a<60&&Convert.ToInt64(textBox2.Text)>=50)
{
label4.Text=“Geç;ti”;
label5.Text=“CC”;
textBox3.Text=a.ToString();
}
其他的
{
label4.Text=“KALDI”;
标签5.Text=“FF”;
textBox3.Text=a.ToString();
}
}
私有无效按钮2\u单击\u 1(对象发送者,事件参数e)
{
textBox1.Text=“”;
textBox2.Text=“”;
textBox3.Text=“”;
label4.Text=“硬质合金”;
label5.Text=“Sonuc”;
}
”。。?这些东西在那里做什么?你从网上复制/粘贴了这些代码吗?
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";
}