基本数据类型:
1、值类型:数字类型
1.整型: 只能放整数的类型,int,long
2.浮点类型: 级别比整型要高,可以放整型和小数点型,double,decimal
2、布尔型:bool
只有对错,不能放其它东西,对:true,错:false
3、字符型:char
最多只能放一个汉字。

引用类型: 只需要记住一个,string字符串类型

练习

1、在控制台程序中打印出来 Hello World!

 Console.Write("Hello world!");
 Console.ReadLine();

运算结果

2、先打印出来 Hello World!,不动了,按一下回车之后,在打印出来一句 世界你好 。

  Console.WriteLine("Hello world!");//输出内容
  Console.ReadLine();//等待一下
  Console.Write("世界你好");//继续输出
  Console.ReadKey();//防止控制台程序闪退

运算结果

3.请输入姓名:

请输入性别:

请输入年龄:
请输入职位:
我的名字叫xxx,我是xxx的。
我今年xxx岁了,我的职位是xxx。

 

            Console.Write("请输入名字:");//输出内容
            string a = Console.ReadLine();//输入内容,回车换行
            Console.Write("请输入性别:");
            string b = Console.ReadLine();
            Console.Write("请输入年龄:");
            string c = Console.ReadLine();
            Console.Write("请输入职位:");
            string d = Console.ReadLine();

            Console.Write("我的名叫");//输出内容
            Console.Write(a);
            Console.Write(",我是");
            Console.Write(b);
            Console.WriteLine("的。");
            Console.Write("我今年");
            Console.Write(c);
            Console.Write("岁了,我的职位是");
            Console.Write(d);
            Console.ReadKey();//接受结果,按下任意键结束

运算结果

 

posted on 2016-05-16 18:53  斐雪  阅读(212)  评论(0编辑  收藏  举报