<p> classclassname<br> {<br> publicstaticdoublecompare(doublex,doubley,doublez)<br> {<br> doubletemp;<br> if(x>y)temp=x;<br> elsetemp=y;<br> if(z>temp)temp=z;<br> returntemp;<br> }<br> }<br> classProgram<br> {<br> staticvoidMain(string[]args)<br> {<br> Console.Write("请输入一个实数:");<br> doublex=double.Parse(Console.ReadLine());<br> Console.Write("请输入一个实数:");<br> doubley=double.Parse(Console.ReadLine());<br> Console.Write("请输入一个实数:");<br> doublez=double.Parse(Console.ReadLine());<br> doubletemp=classname.compare(x,y,z);<br> Console.WriteLine("比较后得到的最大数为{0}",temp);</p>