正在加载图片...
include <iostream. h int max(int, int) int max(int, int, int) double max(double, double) double max(double, double, double); void main( scout<e max 3. max( 3, 4<<endl; cout<< max(3, 4, 5)="<<max(3, 4, 5)<<endl; cout<<max(3.2, 4.3 max (3.2,4.3)<<endl; cout<"max(3.2,4.3,54)="<max(3,2,43,5.4)<<endl int max (int x, int y Rreturn x>y? int max(int x, int y,int z fint tl, t2 -maxX,y) 2=max(y,Z 运行结果为: return max(t1, t2); 3 double max(double x, double y) max(3,4)=4 Breturn x double max double x, double y, double z) max(3,4,5)=5 fdouble t1, t 2: max(32,4.3)=4.3 tl=max max(32,4.3,5.4)=54 max return max(t1, t2); h C++程序设计课件设计制作:徐龙琴C++程序设计课件 设计制作:徐龙琴 9 #include <iostream.h> int max(int,int); int max(int,int,int); double max(double,double); double max(double,double,double); void main() {cout<<"max(3,4)="<<max(3,4)<<endl; cout<<"max(3,4,5)="<<max(3,4,5)<<endl; cout<<"max(3.2,4.3)="<<max(3.2,4.3)<<endl; cout<<"max(3.2,4.3,5.4)="<<max(3.2,4.3,5.4)<<endl;} int max(int x,int y) {return x>y?x:y;} int max(int x,int y,int z) {int t1,t2; t1=max(x,y); t2=max(y,z); return max(t1,t2);} double max(double x,double y) {return x>y?x:y;} double max(double x,double y,double z) {double t1,t2; t1=max(x,y); t2=max(y,z); return max(t1,t2);} 运行结果为: max(3,4)=4 max(3,4,5)=5 max(3.2,4.3)=4.3 max(3.2,4.3,5.4)=5.4
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有