zoukankan      html  css  js  c++  java
  • c#语句

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApplication2
    {
    class Program
    {
    static void Main(string[] args)
    {
    /*Console.Write("请输入整数a:");
    int a = int.Parse(Console.ReadLine());
    Console.Write("请输入整数b:");
    int b = int.Parse(Console.ReadLine());
    Console.WriteLine("a+b="+(a+b));
    Console.WriteLine("a-b="+(a-b));
    Console.WriteLine("a*b="+(a*b));
    Console.WriteLine("a/b="+(a/b));
    Console.ReadLine();*/


    //只可以取值使用,不可以再做值的变更
    //const int chang = 5;

    //int a = 4;
    //int b = 3;
    //bool t = (a==b);
    //Console.WriteLine(t);
    //Console.ReadLine();

     

    /*Console.Write("输入一个年龄:");
    int a = int.Parse(Console.ReadLine());
    if (a >= 18)
    {
    Console.WriteLine("您已成年");
    }
    else
    {
    Console.WriteLine("您未成年");
    }


    Console.ReadLine();*/

     

    //问题:你能跑过豹子么? 接收【能】或者【不能】
    //若能,打印出【你比禽兽还禽兽!!】
    //若不能,打印出【你连禽兽都不如!!】
    //若输入

    /*Console.WriteLine("你能跑过豹子么?(能/不能)");
    string neng= Console.ReadLine();//接收所输入的字符串内容
    //判断输入的内容是【能】、【不能】、还是其他
    //if(){} else if(){} ... else{} 只能选择其一进行执行
    if (neng=="能")
    {
    Console.WriteLine("你比禽兽还禽兽!!");
    }
    else if (neng == "不能")
    {
    Console.WriteLine("你连禽兽都不如!!");
    }
    else
    {
    Console.WriteLine("输入有误!");
    }


    Console.ReadLine();*/


    //两个数x,y,从大到小排列
    /*Console.Write("请输入x=");
    int x = int.Parse(Console.ReadLine());
    Console.Write("请输入y=");
    int y = int.Parse(Console.ReadLine());

    if (x >= y)
    {

    }
    else
    {
    int zhong;//利用中间变量,将两个变量的值进行互换
    zhong = x;
    x = y;
    y = zhong;

    }
    Console.WriteLine(x+" "+y);

    Console.ReadLine();*/


    //输入三个整数a、b、c,将它们排序后以从小到大的顺序打印出来。
    //利用中间变量
    Console.Write("请输入a:");
    int a = int.Parse(Console.ReadLine());
    Console.Write("请输入b:");
    int b = int.Parse(Console.ReadLine());
    Console.Write("请输入c:");
    int c = int.Parse(Console.ReadLine());

    int zhong;
    if (a > b)
    {
    zhong=a;
    a=b;
    b = zhong;
    }
    if(a>c)
    {
    zhong = a;
    a = c;
    c = zhong;
    }
    if (b > c)
    {
    zhong = b;
    b = c;
    c = zhong;
    }
    Console.Write(a+" "+b+" "+c);
    Console.ReadLine();

     

     


    /*Console.Write("请输入x=");
    int x = int.Parse(Console.ReadLine());
    Console.Write("请输入y=");
    int y = int.Parse(Console.ReadLine());
    Console.Write("请输入z=");
    int z = int.Parse(Console.ReadLine());

    if(x<y&&x<z)
    {
    Console.WriteLine(x);
    if (y < z)
    {
    Console.WriteLine(y); Console.WriteLine(z);
    }
    else
    {
    Console.WriteLine(z); Console.WriteLine(y);
    }

    }
    if (y < x && y < z)
    {
    Console.WriteLine(y);
    if (x < z)
    {
    Console.WriteLine(x); Console.WriteLine(z);
    }
    else
    {
    Console.WriteLine(z); Console.WriteLine(x);
    }
    }
    if (z < x && z <y)
    {
    Console.WriteLine(z);
    if (x < y)
    {
    Console.WriteLine(x); Console.WriteLine(y);
    }
    else
    {
    Console.WriteLine(y); Console.WriteLine(x);
    }

    }
    Console.ReadLine();*/


    //输入一个小于等于100的整数,判断:
    //是小于10的
    //两位数
    //是100

    /*Console.Write("输入一个小于等于100的整数:");
    int a = int.Parse(Console.ReadLine());
    if (a <= 100)//先保证输入的数是小于等于100的
    {
    if (a < 10)//排除小于10的部分
    {
    Console.WriteLine("这个数是小于10的.");
    }
    else
    {
    if (a == 100)//排除100
    {
    Console.WriteLine("这个数是100.");
    }
    else//剩下的就是10-99的两位数的部分
    {
    Console.WriteLine("这个数是两位数.");
    }
    }
    }
    else

    Console.WriteLine("输入有误!");


    Console.ReadLine();*/


    //输入学生姓名,输入考试成绩
    //若是100,【恭喜你**,满分通过!】
    //若是大于80小于100,【**你很优秀,继续保持!】
    //若是大于等于60小于80,【**成绩良好】
    //大于等于50小于60,【**就差一丢丢,下次一定要至少及格!
    //小于50,【**你是笨蛋么?】

    /*Console.Write("请输入学生姓名:");
    string name = Console.ReadLine();
    Console.Write("请输入考试成绩:");
    double a = double.Parse(Console.ReadLine());//因为分数可能会有小数部分
    if (a >= 0 && a <= 100)//确定好大范围(成绩是0-100)
    {
    if (a == 100)//排除掉100
    {
    Console.WriteLine("恭喜" + name + ",满分通过");
    }
    else//0-99
    {
    if (a >= 80)//排除80以上
    {
    Console.WriteLine(""+name+"你很优秀,继续保持!");
    }
    else//剩下0-79
    {
    if (a >= 60)//排除60以上
    {
    Console.WriteLine("" + name + "成绩良好");
    }
    else//剩下0-59
    {
    if (a >= 50)//排除50以上
    {
    Console.WriteLine("" + name + "就差一丢丢,下次一定要至少及格");
    }
    else//剩下0-49
    {
    Console.WriteLine("" + name + "你是笨蛋吗");
    }
    }
    }
    }
    }
    Console.ReadLine();*/

     

     

     


    }
    }
    }

  • 相关阅读:
    Autofs
    markdown 基本语法
    Why Linux Doesn’t Need Defragmenting
    How to reconfigure installed dpkg package (tzdata, locales)
    weblogic性能监控
    exec
    在Oracle中查询表的大小
    hadoop主要概念的理解和学习
    ORACLE ASM中查询表空间使用情况、数据文件路径、裸设备磁盘总大小剩余大小
    linux 查看内存和cpu占用比较多的进程
  • 原文地址:https://www.cnblogs.com/Fate-rail/p/4920991.html
Copyright © 2011-2022 走看看