计算器的设计中为什么类中的public的函数不可用???
using System;using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication11
{
public partial class Form1 : Form
{
public string a;
public string b;
jisuanqi ji = new jisuanqi();
string n = "";
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
richTextBox1.Text = richTextBox1.Text+"1";
}
private void button2_Click(object sender, EventArgs e)
{
richTextBox1.Text = richTextBox1.Text+"2";
}
private void button3_Click(object sender, EventArgs e)
{
richTextBox1.Text = richTextBox1.Text+"3";
}
private void button4_Click(object sender, EventArgs e)
{
richTextBox1.Text = richTextBox1.Text+"4";
}
private void button5_Click(object sender, EventArgs e)
{
richTextBox1.Text = richTextBox1.Text+"5";
}
private void button6_Click(object sender, EventArgs e)
{
richTextBox1.Text = richTextBox1.Text+"6";
}
private void button7_Click(object sender, EventArgs e)
{
richTextBox1.Text = richTextBox1.Text + "7";
}
private void button8_Click(object sender, EventArgs e)
{
richTextBox1.Text = richTextBox1.Text + "8";
}
private void button9_Click(object sender, EventArgs e)
{
richTextBox1.Text = richTextBox1.Text + "9";
}
private void button10_Click(object sender, EventArgs e)
{
richTextBox1.Text = richTextBox1.Text + "0";
}
private void button11_Click(object sender, EventArgs e)
{
a= richTextBox1.Text;
richTextBox1.Text = " ";
n = "-";
}
private void button12_Click(object sender, EventArgs e)
{
a= richTextBox1.Text;
richTextBox1.Text = " ";
n = "*";
}
private void button13_Click(object sender, EventArgs e)
{
a = richTextBox1.Text;
richTextBox1.Text = " ";
n = "/";
}
private void button14_Click(object sender, EventArgs e)
{
a = richTextBox1.Text;
n = "sqrt";
richTextBox1.Text = " ";
}
private void button15_Click(object sender, EventArgs e)
{
a= richTextBox1.Text;
n = "fushu";
richTextBox1.Text = " ";
}
private void button16_Click(object sender, EventArgs e)
{
b = richTextBox1.Text;
richTextBox1.Text = "=";
switch (n)
{
case "+": richTextBox1.Text = (ji.yunsuanjia( a, b)).ToString(); break;
case "-": richTextBox1.Text = (ji.yunsuanjian(a, b)).ToString(); break;
case "*": richTextBox1.Text = (ji.yunsuancheng(a, b)).ToString(); break;
case "/": richTextBox1.Text = (ji.yunsuanchu(a, b)).ToString(); break;
case "sqrt": richTextBox1.Text = (ji.kaifang(a).ToString()); break;
}
}
private void button17_Click(object sender, EventArgs e)
{
a= richTextBox1.Text;
n = "+";
richTextBox1.Text = " ";
}
}
public class jisuanqi
{
public int yunsuanjia(string a, string b)
{
int c = Convert.ToInt32(a) + Convert.ToInt32(b);
return c;
}
public int yusuanjian(string a, string b)
{
int c = Convert.ToInt32(a) - Convert.ToInt32(b);
return c;
}
public int yusuancheng(string a, string b)
{
int c = Convert.ToInt32(a) * Convert.ToInt32(b);
return c;
}
public int yusuanchu(string a, string b)
{
int c = Convert.ToInt32(a) / Convert.ToInt32(b);
return c;
}
public int kaifang(string a)
{
int c = Convert.ToInt32(Math.Sqrt(Convert.ToInt32(a)));
return c;
}
}
}