function has multiple return values

Source: Internet
Author: User

classProgram {/// <summary>        ///solve a two -dimensional equation/// </summary>        /// <param name= "a" ></param>        /// <param name= "B" ></param>        /// <param name= "C" ></param>        /// <param name= "D" ></param>        /// <param name= "E" ></param>        /// <returns></returns>         Public intJiefangcheng (intAintBintC out DoubleX1, out Doublex2) {X1=0; X2=0; if(A = =0)            {                return 3; }            Else            {            intdel = b * B-4AC; if(Del >0) {x1= (-B + math.sqrt (DEL))/(2*a); X2= (-b-math.sqrt (del))/(2*a); return 2; }            Else if(Del = =0) {x1= (-B + math.sqrt (DEL))/(2*a); X2=X1; return 1; }            Else            {                return 0; }            }        }        Static voidMain (string[] args) {            //solve a two -dimensional equationConsole.Write ("Please enter a="); intA =int.            Parse (Console.ReadLine ()); Console.Write ("Please enter b="); intb =int.            Parse (Console.ReadLine ()); Console.Write ("Please enter c="); intc =int.            Parse (Console.ReadLine ()); Doublex1, x2; intJieguo =NewProgram (). Jiefangcheng (A,b,c, outX1, outx2); if(Jieguo = =0) {Console.WriteLine ("equation without real roots"); }            if(Jieguo = =1) {Console.WriteLine ("The equation has two equal real roots x1=x2="+x1); }            if(Jieguo = =2) {Console.WriteLine ("The equation has two equal real roots x1="+ x1 +"x2="+x2); }            if(Jieguo = =3) {Console.WriteLine ("not a unary two-time equation .");        } console.readline (); }    }

function has multiple return values

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.