|
// jjj.cpp : Defines the entry point for the console application.<br/> //</p><p> #include <iostream.h><br/> class MaxMin8<br/> {<br/> private:<br/> int a,b,c,d,e,f,j,g;<br/> int Max(int,int);<br/> int Min(int,int);<br/> public:<br/> void Set(int,int,int,int,int,int,int,int);<br/> int Max();<br/> int Min();<br/> };<br/> int MaxMin8::Max(int v,int n)<br/> { if(v>n) return v;<br/> else return n;<br/> }<br/> int MaxMin8::Min(int v,int n)<br/> { if(v>n) return n;<br/> else return v;<br/> }<br/> void MaxMin8::Set(int x1,int x2,int x3,int x4,int x5,int x6, int x7,int x8)<br/> { a=x1;b=x2;c=x3;d=x4;e=x5;f=x6;j=x7;g=x8;}<br/> int MaxMin8::Max()<br/> { int x,y,h,s,z,v,n;<br/> x=Max(a,b);<br/> y=Max(c,d);h=Max(e,f);s=Max(j,g);<br/> z=Max(x,y);v=Max(h,s);n=Max(z,s);<br/> return n;<br/> }<br/> int MaxMin8::Min()<br/> { int x,y,z,h,s,v,n;<br/> x=Min(a,b);<br/> y=Min(c,d);h=Min(e,f);s=Min(j,g);<br/> z=Min(x,y);v=Min(h,s);n=Min(z,s);<br/> return n;<br/> }<br/> void main()<br/> {<br/> MaxMin8 M4;<br/> M4.Set(1,2,3,4,5,6,7,8);<br/> cout<<"输出最大值"<<M4.Max()<<endl;<br/> cout<<"输出最小值"<<M4.Min()<<endl;<br/> } |
|