刚学编程2月,想编个计算器,有人能帮我看看代码吗?迷糊弄了半天,写了些乱七八糟的运行不了的代码
好多东西都是看的时候能看懂,但是只要一让自己做就不着从那开始,
哪位能帮我看下,看我那些方面问题比较严重,现在对编程还迷迷的,自我感觉啥也不懂的样子。
namespace WindowsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button12_Click(object sender, EventArgs e)
{
string s = "*";
this.txtShow.Text += s;
} private void Form1_Load(object sender, EventArgs e)
{ } private void btn0_Click(object sender, EventArgs e)
{
string s = "0";
this.txtShow.Text += s;
} private void txtShow_TextChanged(object sender, EventArgs e)
{ } private void btn1_Click(object sender, EventArgs e)
{
string s = "1";
this.txtShow.Text += s;
} private void btn2_Click(object sender, EventArgs e)
{
string s = "2";
this.txtShow.Text += s;
} private void btn3_Click(object sender, EventArgs e)
{
string s = "3";
this.txtShow.Text += s;
} private void btn4_Click(object sender, EventArgs e)
{
string s = "4";
this.txtShow.Text += s;
} private void btn5_Click(object sender, EventArgs e)
{
string s = "5";
this.txtShow.Text += s;
} private void btn6_Click(object sender, EventArgs e)
{
string s = "6";
this.txtShow.Text += s;
} private void btn7_Click(object sender, EventArgs e)
{
string s = "7";
this.txtShow.Text += s;
} private void btn8_Click(object sender, EventArgs e)
{
string s = "8";
this.txtShow.Text += s;
} private void btn9_Click(object sender, EventArgs e)
{
string s = "9";
this.txtShow.Text += s;
} private void btnd_Click(object sender, EventArgs e)
{
string s = ".";
this.txtShow.Text += s;
} private void btnjia_Click(object sender, EventArgs e)
{
MyClass temp = new MyClass();
temp.x = this.txtShow.Text;
string s = "+";
temp.z = s;
this.txtShow.Text ="";
} private void btnjian_Click(object sender, EventArgs e)
{
string s = "-";
this.txtShow.Text += s;
} private void btnchu_Click(object sender, EventArgs e)
{
string s = "/";
this.txtShow.Text += s;
} private void btnok_Click(object sender, EventArgs e)
{
MyClass temp = new MyClass();
temp.y = this.txtShow.Text;
this.txtShow.Text = temp.i;
} private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("http://wpa.qq.com/msgrd?V=1&Uin=82101007&Site=ioshenmue&Menu");
} private void label1_Click(object sender, EventArgs e)
{ }
}
class MyClass
{
public string x,y,z,i;
public MyClass()
{
string x;
string y;
string z;
string i;
}
}
class MyClass1
{
public void tem()
{
MyClass temp1 = new MyClass();
double a = double.Parse(temp1.x);
double b = double.Parse(temp1.y);
string z = temp1.z;
double c;
string d;
switch (z)
{
case "+":
c=a + b;
d = c.ToString();
temp1.i = d;
break;
case "-":
c = a -b;
d = c.ToString();
temp1.i = d;
break;
case "*":
c = a *b;
d = c.ToString();
temp1.i = d;
break;
case "/":
c = a /b;
d = c.ToString();
temp1.i = d;
break;
default:
break;
}
}
}
}
好多东西都是看的时候能看懂,但是只要一让自己做就不着从那开始,
哪位能帮我看下,看我那些方面问题比较严重,现在对编程还迷迷的,自我感觉啥也不懂的样子。
namespace WindowsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button12_Click(object sender, EventArgs e)
{
string s = "*";
this.txtShow.Text += s;
} private void Form1_Load(object sender, EventArgs e)
{ } private void btn0_Click(object sender, EventArgs e)
{
string s = "0";
this.txtShow.Text += s;
} private void txtShow_TextChanged(object sender, EventArgs e)
{ } private void btn1_Click(object sender, EventArgs e)
{
string s = "1";
this.txtShow.Text += s;
} private void btn2_Click(object sender, EventArgs e)
{
string s = "2";
this.txtShow.Text += s;
} private void btn3_Click(object sender, EventArgs e)
{
string s = "3";
this.txtShow.Text += s;
} private void btn4_Click(object sender, EventArgs e)
{
string s = "4";
this.txtShow.Text += s;
} private void btn5_Click(object sender, EventArgs e)
{
string s = "5";
this.txtShow.Text += s;
} private void btn6_Click(object sender, EventArgs e)
{
string s = "6";
this.txtShow.Text += s;
} private void btn7_Click(object sender, EventArgs e)
{
string s = "7";
this.txtShow.Text += s;
} private void btn8_Click(object sender, EventArgs e)
{
string s = "8";
this.txtShow.Text += s;
} private void btn9_Click(object sender, EventArgs e)
{
string s = "9";
this.txtShow.Text += s;
} private void btnd_Click(object sender, EventArgs e)
{
string s = ".";
this.txtShow.Text += s;
} private void btnjia_Click(object sender, EventArgs e)
{
MyClass temp = new MyClass();
temp.x = this.txtShow.Text;
string s = "+";
temp.z = s;
this.txtShow.Text ="";
} private void btnjian_Click(object sender, EventArgs e)
{
string s = "-";
this.txtShow.Text += s;
} private void btnchu_Click(object sender, EventArgs e)
{
string s = "/";
this.txtShow.Text += s;
} private void btnok_Click(object sender, EventArgs e)
{
MyClass temp = new MyClass();
temp.y = this.txtShow.Text;
this.txtShow.Text = temp.i;
} private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("http://wpa.qq.com/msgrd?V=1&Uin=82101007&Site=ioshenmue&Menu");
} private void label1_Click(object sender, EventArgs e)
{ }
}
class MyClass
{
public string x,y,z,i;
public MyClass()
{
string x;
string y;
string z;
string i;
}
}
class MyClass1
{
public void tem()
{
MyClass temp1 = new MyClass();
double a = double.Parse(temp1.x);
double b = double.Parse(temp1.y);
string z = temp1.z;
double c;
string d;
switch (z)
{
case "+":
c=a + b;
d = c.ToString();
temp1.i = d;
break;
case "-":
c = a -b;
d = c.ToString();
temp1.i = d;
break;
case "*":
c = a *b;
d = c.ToString();
temp1.i = d;
break;
case "/":
c = a /b;
d = c.ToString();
temp1.i = d;
break;
default:
break;
}
}
}
}
第一个程序哎。
namespace WindowsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button12_Click(object sender, EventArgs e)
{
this.temp1.Text = this.txtShow.Text;
string s = "*";
this.temp3.Text = s;
this.txtShow.Text = "";
} private void Form1_Load(object sender, EventArgs e)
{ } private void btn0_Click(object sender, EventArgs e)
{
string s = "0";
this.txtShow.Text += s;
} private void txtShow_TextChanged(object sender, EventArgs e)
{ } private void btn1_Click(object sender, EventArgs e)
{
string s = "1";
this.txtShow.Text += s;
} private void btn2_Click(object sender, EventArgs e)
{
string s = "2";
this.txtShow.Text += s;
} private void btn3_Click(object sender, EventArgs e)
{
string s = "3";
this.txtShow.Text += s;
} private void btn4_Click(object sender, EventArgs e)
{
string s = "4";
this.txtShow.Text += s;
} private void btn5_Click(object sender, EventArgs e)
{
string s = "5";
this.txtShow.Text += s;
} private void btn6_Click(object sender, EventArgs e)
{
string s = "6";
this.txtShow.Text += s;
} private void btn7_Click(object sender, EventArgs e)
{
string s = "7";
this.txtShow.Text += s;
} private void btn8_Click(object sender, EventArgs e)
{
string s = "8";
this.txtShow.Text += s;
} private void btn9_Click(object sender, EventArgs e)
{
string s = "9";
this.txtShow.Text += s;
} private void btnd_Click(object sender, EventArgs e)
{
string s = ".";
this.txtShow.Text += s;
} private void btnjia_Click(object sender, EventArgs e)
{
this.temp1.Text = this.txtShow.Text;
string s = "+";
this.temp3.Text = s;
this.txtShow.Text ="";
} private void btnjian_Click(object sender, EventArgs e)
{
this.temp1.Text = this.txtShow.Text;
string s = "-";
this.temp3.Text = s;
this.txtShow.Text = "";
} private void btnchu_Click(object sender, EventArgs e)
{
this.temp1.Text = this.txtShow.Text;
string s = "/";
this.temp3.Text = s;
this.txtShow.Text = "";
} private void btnok_Click(object sender, EventArgs e)
{
this.temp2.Text = this.txtShow.Text;
double a = double.Parse(this.temp1.Text);
double b = double.Parse(this.temp2.Text);
string z = this.temp3.Text;
double c;
string d;
switch (z)
{
case "+":
c = a + b;
d = c.ToString();
this.txtShow.Text = d;
break;
case "-":
c = a - b;
d = c.ToString();
this.txtShow.Text = d;
break;
case "*":
c = a * b;
d = c.ToString();
this.txtShow.Text = d;
break;
case "/":
c = a / b;
d = c.ToString();
this.txtShow.Text=d;
break;
default:
break;
}
} private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("http://wpa.qq.com/msgrd?V=1&Uin=82101007&Site=ioshenmue&Menu");
} private void label1_Click(object sender, EventArgs e)
{ } private void btnclear_Click(object sender, EventArgs e)
{
this.txtShow.Text = "";
} private void temp1_Click(object sender, EventArgs e)
{ }
}