zoukankan      html  css  js  c++  java
  • 语言基础+数据类型

    基本数据类型:
    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();//接受结果,按下任意键结束

    运算结果

  • 相关阅读:
    记一道有趣的数学题
    BJOI2018 二进制
    BJOI2016 IP地址
    BJOI2016 回转寿司
    BJOI2017 开车
    BJOI2019 光线
    java 下载
    springboot 运行相关命令
    sql mapper 里面 Integer 类型判断
    springboot 访问jar同级别下的文件访问问题
  • 原文地址:https://www.cnblogs.com/sunshuping/p/5498638.html
Copyright © 2011-2022 走看看