|
#include <iostream.h><br/> class MaxMin6<br/> {<br/> private:<br/> int a,b,c,d,e,f;<br/> int Max(int,int);<br/> int Min(int,int);<br/> public:<br/> void Set(int,int,int,int,int,int);<br/> int Max();<br/> int Min();<br/> };<br/> int MaxMin6::Max(int v,int n)<br/> { if(v>n) return v;<br/> else return n;<br/> }<br/> int MaxMin6::Min(int v,int n)<br/> { if(v>n) return n;<br/> else return v;<br/> }<br/> void MaxMin6::Set(int x1=0,int x2=0,int x3=0,int x4=0,int x5=0,int x6=0)<br/> { a=x1;b=x2;c=x3;d=x4;e=x5;f=x6;<br/> cout<<"请输入六个数:"<<endl;<br/> cout<<"输入:"<<endl;<br/> cin>>a;<br/> cout<<"输入:"<<endl;<br/> cin>>b;<br/> cout<<"输入:"<<endl;<br/> cin>>c;<br/> cout<<"输入:"<<endl;<br/> cin>>d;<br/> cout<<"输入:"<<endl;<br/> cin>>e;<br/> cout<<"输入:"<<endl;<br/> cin>>f;<br/> }<br/> int MaxMin6::Max()<br/> { int x,y,h,s,z;<br/> x=Max(a,b);<br/> y=Max(c,x);h=Max(e,d);s=Max(h,f);<br/> z=Max(s,y);<br/> return z;<br/> }<br/> int MaxMin6::Min()<br/> { int x,y,z,h,s;<br/> x=Min(a,b);<br/> y=Min(c,x);h=Min(e,d);s=Min(h,f);<br/> z=Min(s,y);<br/> return z;<br/> }<br/> void main()<br/> {<br/> MaxMin6 M6;<br/> M6.Set();<br/> cout<<"输出最大值"<<M6.Max()<<endl;<br/> cout<<"输出最小值"<<M6.Min()<<endl;<br/> } |
|