CH02_01

6种类型

namespace CH02_01
{
    class Program
    {
        static void Main(string[] args)
        {
            //1.数据类型:整型int、浮点型float double、字符型char
            int a = 100;//默认的整数都是十进制
            int b = 0x32;//十六进制以0x开头

            //2.实数类型:float double
            float f = 3.14f;
            double d = 3.1415926D;

            //3.字符类型:单个字符
            char ch1 = 'a';
            char ch2 = '8';
            char ch3 = '\n';

            //4.字符串类型:0个或者多个字符
            string s1 = "";//0个字符
            string s2 = "Car is running";

            //5.布尔类型:true false
            bool b1 = true;
            bool b2 = false;
            bool b3 = 2 > 3;

            //6.符号常量:固定的值(光的速度)
            const float Speed = 380000;
            Console.WriteLine("光的速度是:{0}公里",Speed);
        }
    }
}

你可能感兴趣的:(CH02_01)