當前位置:編程學習大全網 - 編程軟體 - 最大值在編程中的作用是

最大值在編程中的作用是

#包含“stdio.h”

Ints_max(inta,intb,intc)/*最大函數*/

{

intmax

如果(a & gt=b)

max = a;

其他

max = b;

if(max & lt;c)

max = c;

returnmax

}

Ints_min(inta,intb,intc)/*最小值函數*/

{

intmin

如果(a & gt=b)

min = b;

其他

min = a;

if(min & gt;c)

min = c;

returnmin

}

Floats_pin(inta,intb,intc)/*平均函數*/

{

floatpin

pin =(a+b+c)/3.0;

returnpin

}

勉()

{

inta,b,c;

Printf("請輸入三個整數:");

scanf("%d,%d,%d ",& amp壹,& ampb & amp;c);

Printf("這三個整數的最大值是:%d ",s_max(a,b,c));

Printf("這三個整數的最小值是:%d ",s_min(a,b,c));

Printf("這三個整數的平均值是:%f ",s_pin(a,b,c));

getch();

}

擴展數據

11H1333:三個數的最大值。

# include & ltbits/stdc++。h & gt

usingnamespacestd

intmain(){

inta,b,c;

CIN & gt;& gta & gt& gtb & gt& gtc;

cout & lt& ltmax(max(a,b),max(b,c));

return0

}

  • 上一篇:小學生假期作息時間表模板
  • 下一篇:飛機怎麽做?
  • copyright 2024編程學習大全網