• 面向过程5----c#


    c#的语法看上去跟java好像

    c#是一门编程语言,主要用于.net框架开发中

    c#的文件名后缀是cs.   examp.cs

    hello word!


    using System;

    namespace HelloWold

    {

        class Hello

      {

        static void Main(string[] args) /*java中main函数是小写,string则是大写*/

        {

          /*我的第一个c#程序*/

          Console.WriteLine("hello world");

          Console.ReadKey();

        }

      } 

    }


     实现求二元一次方程的根


    root.cs

    using System;

    using 数学相关;

    namespace root

    {

      class Root

      {

        int a,b,c;/*假设已经赋值*/

        root=b*b-4*a*c;

        root1=(-b+Math.sqrt(root))/2/a;

        root2=(-b-Math.sqrt(root))/2/a;

               public string root(){

          if(a<0)

          {

               return Console.WriteLine("这不是二元一次方程");

          }

          else if(a=0)

          {

            return Console.WriteLine("有一个根,值是:"+root1);

          }

          else

          {

            return Console.WriteLine("有两个根,根一:"+root1+",  根二:"+root2);

          }

        }

      }

      class RootMain

      {

        static void Main(string[] args)

        {

          Root root=new Root();

                     root.root();

        }

      }

    }

  • 相关阅读:
    使用binlog恢复数据
    Xtrabackup增量差量备份
    解压腾讯DB冷备的xb文件
    mysqldump
    xtrabackup备份选项
    MySQL的各种日志
    MySQL的事务相关概念
    LVS(dr)+keepalived
    MeasureSpec学习
    网络通信机制:Socket、TCP/IP、HTTP
  • 原文地址:https://www.cnblogs.com/kaililikai/p/5804285.html
Copyright © 2020-2023  润新知