zoukankan      html  css  js  c++  java
  • 0924,函数返回多个值

        class Program    

    {                

    //函数多个返回值        

    //输入参数前加Out就变成输出参数        

    public int jisuan(int a, int b, out int c)        

    {            

    c = a - b;            

    return a + b;        

    }

           

    public int jiefangcheng(int a, int b, int c, out double x1, out double x2)        

    {            

    x1 = 0;            

    x2 = 0;            

    if (0 == b * b - 4 * a * c)            

    {                

    x1 = (-b) / (2 * a);                

    x2 = x1;                

    return 1;            

    }            

    else if (0 < b * b - 4 * a * c)            

    {                

    x1 = (-b + Math.Sqrt(b * b - 4.0 * a * c)) / (2.0 * a);                

    x2 = (-b - Math.Sqrt(b * b - 4.0 * a * c)) / (2.0 * a);                

    return 2;            

    }            

    else            

    {                

    return 0;            

    }        

    }

  • 相关阅读:
    UVA1599 理想路径 Ideal Path(最短路径)
    换根DP
    小w的魔术扑克(树状数组+并查集)
    NOIP 2016蚯蚓(优先队列)
    ZR 动物园
    T105017 seq(DP)
    noip2017酱油记
    noip2017酱油记前篇
    P1985 翻转棋
    luogu P2512 [HAOI2008]糖果传递
  • 原文地址:https://www.cnblogs.com/jlhea/p/4940750.html
Copyright © 2011-2022 走看看