标签:
====算术运算符=====
int a, b;
Console.Write("请输入a:");
a = int.Parse(Console.ReadLine());
Console.Write("请输入b:");
b=int.Parse(Console.ReadLine());
int c=a%b;
Console.WriteLine(c);
a = a = b;
a++;//a=a+1
a--;
++a;//a=a+1
--a;
int d = a++;//后++在语句执行完之后才执行
int d = ++a;//a=a+1; int d=a
int d = a; a = a + 1;
Console.WriteLine(d);
Console.WriteLine(a);
====比较yun算符===
int a, b;//定义两变量
Console.Write("请输入a:");
a = int.Parse(Console.ReadLine());//控制台输入一个数,转换成int后,
Console.Write("请输入b:");
b = int.Parse(Console.ReadLine());
Console.Write("请输入c:");
c = int.Parse(Console.ReadLine());
bool c = a != b;//比较表达式返回一个bool值
Console.WriteLine(c);
Console.WriteLine();
====逻辑运算符===
while (true)
{
int a, b, c, d;
Console.Write("请输入a:");
a = int.Parse(Console.ReadLine());
Console.Write("请输入b:");
b = int.Parse(Console.ReadLine());
Console.Write("请输入c:");
c = int.Parse(Console.ReadLine());
Console.Write("请输入d:");
d = int.Parse(Console.ReadLine());
//bool jg = a > b && a > c && a>d;
bool jg = !(a > b || a > c);
Console.WriteLine(jg);
标签:
原文地址:http://www.cnblogs.com/lz123/p/4940326.html