using System;
using System.Windows.Forms;
namespace TestVariable
{
public partial class TestOperator : Form
{
private void TestVariable_Load(object sender, EventArgs e)
{
int a, b = 5;
char c1 = 'A';
a = c1; //字符型转整型
float x = 3;
x += b; //整型转浮点型
lblShow.Text = "a=" + a; //整型转为字符串
lblShow.Text += "\nx=" + x; //浮点型转为字符串
}
}
}
using System;
using System.Windows.Forms;
namespace TestVariable
{
public partial class TestOperator : Form
{
private void TestVariable_Load(object sender, EventArgs e)
{
int i = 25, j = 12;
bool k;
string result = " i!=j的值为" + (i != j);
result += "\n i!=j && i>=j的值为" + (i != j && i >= j);
result += "\n i!=j && i>=j+20的值为" +(i != j && i >= j + 20);
result += "\n k = i!=j && i>=j的值为" + (k=i != j && i >= j);
lblShow.Text = result;
}
}
因篇幅问题不能全部显示,请点此查看更多更全内容