运算符
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication3 { class Program { static void Main(string[] args) { ////运算符 ////++ -- //int a = 0; //int b = a++;//int b=a;a=a+1; //int c = ++a;//a=a+1;int c=a; ////++a;//a=a+1; //Console.WriteLine(b); //Console.WriteLine(c); //Console.ReadLine(); //* / % //double a = 47; //bool b = a % 10 == 7; //Console.WriteLine(); //Console.ReadLine(); //+ - //注意加号在遇到字符串类型的时候表示的是拼接作用 //关系运算符 //> < >= <= //== != //int a = 7; //int b = 8; //bool c = a >= b; //逻辑运算符 //&& 与 两边都要成立 //|| 或 只需要有一个成立 //! 非 取原本的反方向 //int a = 4; int b = 5; int c = 6; //bool d = a > b || c >= b; //条件运算符 //?: //int e = a <= b ? 1 : 2; //赋值运算符 //= += -= *= /= %= //a += b;//a=a+b; //a *= b;//a=a*b; //Console.WriteLine(a); //Console.ReadLine(); //问,现在几点了? //若是12小时之内,am //若是13——24之间是,pm。若是下午需要减掉12进行报时 Console.Write("现在几点了?"); int hour = int.Parse(Console.ReadLine()); string mm = hour > 12 ? (hour-12)+"pm" : hour+"am"; Console.WriteLine("现在是"+mm); Console.ReadLine(); } } }