namespace ConsoleApp1
{
class Program
{
static void Main(string[] args) //方法必须包含在类中;程序的编译和运行从main()方法开始;
{
//Console.WriteLine("1+1=",1 + 1);
//Console.WriteLine("1-1=",1 - 1);
//Console.WriteLine("1*1=",1 * 1);
//Console.WriteLine("1/1=", 1 / 1);
数据类型-整型(int)
byte,short,int,long;
//int a = 10000; // "=" -- 赋值运算符;
//int a1 = 1000;
//Console.WriteLine(a + a1);
// //byte长度1个字节;
// //short长度2个字节;
// //int长度4个字节
// //long长度8个字节;
//int a3 = 5;
//int a4 = 7;
//Console.WriteLine(a3 += a4); //a3 += a4 -> a3 =(a3 + a4);
//Console.WriteLine(a3 -= a4); //a3 -= a4 -> a3 =(a3 - a4);
//Console.WriteLine(a3 *= a4); //a3 *= a4 -> a3 =(a3 * a4);
//Console.WriteLine(a3 /= a4); //a3 /= a4 -> a3 =(a3 / a4);
//Console.WriteLine(a3 %= a4); //a3 %= a4 -> a3 =(a3 % a4);
//float f = 0.7f;
//float f1 = 1f; //浮点型变量可以存储整型数据;
//double d = 17.7d;
数据类型--浮点型(float)
float,double;
float长度 4 个字节;
double长度 8 个字节;
//数据类型--字符型(string)
//char c="a" //char只能存放单个字符;
//string s = "hello world"; //字符串数据用单('')双("")引号括住
//
// int age = 27;
// float id = 2.5f;
// string name = "ikun";
// string ability="唱,跳,篮球";
// string says="你干嘛 嗨哟";
//Console.WriteLine("我是"+"\t" + name + "\t" + "今年 " + "\t" + age + "\t" + "岁"+ "\t" + "练习 " + "\t" + id + "\t" + "年"+"\n"+"换行"); //Console.Write() 不换行;“\t”-- 空格; “\n”-- 换行;
//数据类型--布尔值(bool)
//bool b = true; //只有真(true)或假(false);
//Console.WriteLine(b);
//int a = 3;
//int b = 4;
//bool c = 3 < 4; //确定的值(0/1)不能代替bool值,表达式可以代替;
//Console.WriteLine(c);
}
}
}