</pre></div><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">4: </span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">#include <iostream></span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">using namespace std;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">class Student</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {public:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Student(int n,float s):num(n),score(s){}</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> void display();</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> private:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int num;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> float score;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> };</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">void Student::display()</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {cout<<num<<" "<<score<<endl;}</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">int main()</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">{Student stud[5]={</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Student(101,78.5),Student(102,85.5),Student(103,98.5),</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Student(104,100.0),Student(105,95.5)};</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Student *p=stud;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> for(int i=0;i<=2;p=p+2,i++)</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> p->display();</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> return 0;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> }</span></p><span style="font-family:Calibri;font-size: 10.5pt;"></span><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">5:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">#include <iostream></span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">using namespace std;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">class Student</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {public:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Student(int n,float s):num(n),score(s){}</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int num;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> float score;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> };</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">void main()</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">{Student stud[5]={</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Student(101,78.5),Student(102,85.5),Student(103,98.5),</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Student(104,100.0),Student(105,95.5)};</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> void max(Student* );</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Student *p=&stud[0];</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> max(p);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> }</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">void max(Student *arr)</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">{float max_score=arr[0].score;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int k=0;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> for(int i=1;i<5;i++)</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> if(arr[i].score>max_score) {max_score=arr[i].score;k=i;}</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> cout<<arr[k].num<<" "<<max_score<<endl;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><span style="font-family:Calibri;font-size: 10.5pt;"></span><p class="MsoNormal">}</p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">8</span><span style="font-family:宋体;font-size: 10.5pt;">:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">#include <iostream></span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">using namespace std;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">class Student</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {public:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Student(int n,float s):num(n),score(s){}</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> void change(int n,float s) {num=n;score=s;}</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> void display() {cout<<num<<" "<<score<<endl;}</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> private:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int num;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> float score;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> };</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">int main()</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">{Student stud(101,78.5);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> void fun(Student&);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> fun(stud);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> return 0; </span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">}</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">void fun(Student &stu)</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">{stu.display();</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">stu.change(101,80.5);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> stu.display();</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">}</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">9</span><span style="font-family:宋体;font-size: 10.5pt;">:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">#include <iostream></span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">using namespace std;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">class Product</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {public:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Product(int n,int q,float p):num(n),quantity(q),price(p){};</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> void total();</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> static float average();</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> static void display();</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;"> private:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int num;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int quantity;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> float price;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> static float discount;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> static float sum;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> static int n;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> };</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">void Product::total()</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {float rate=1.0;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> if(quantity>10) rate=0.98*rate;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> sum=sum+quantity*price*rate*(1-discount);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> n=n+quantity;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> }</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">void Product::display()</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {cout<<sum<<endl;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> cout<<average()<<endl;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> }</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">float Product::average()</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {return(sum/n);}</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">float Product::discount=0.05;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">float Product::sum=0;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">int Product::n=0;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">int main()</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Product Prod[3]={</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Product(101,5,23.5),Product(102,12,24.56),Product(103,100,21.5)</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> };</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> for(int i=0;i<3;i++)</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Prod[i].total();</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Product::display();</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> return 0;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> }</span></p><span style="font-family:Calibri;font-size: 10.5pt;"></span><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> 10</span><span style="font-family:宋体;font-size: 10.5pt;">:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">#include <iostream></span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">using namespace std;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">class Date;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">class Time</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {public:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Time(int,int,int);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> friend void display(const Date &,const Time &);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> private:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int hour;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int minute;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int sec;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> };</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;"> Time::Time(int h,int m,int s)</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {hour=h;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> minute=m;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> sec=s;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> }</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">class Date</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {public:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">Date(int,int,int);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> friend void display(const Date &,const Time &);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> private:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int month;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int day;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int year;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> };</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">Date::Date(int m,int d,int y)</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {month=m;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> day=d;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> year=y;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> }</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">void display(const Date &d,const Time &t)</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> cout<<d.month<<"/"<<d.day<<"/"<<d.year<<endl;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> cout<<t.hour<<":"<<t.minute<<":"<<t.sec<<endl;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> }</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">int main()</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">{</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Time t1(10,13,56);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Date d1(12,25,2004);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> display(d1,t1);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> return 0;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><span style="font-family:Calibri;font-size: 10.5pt;"></span><p class="MsoNormal">}</p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">11</span><span style="font-family:宋体;font-size: 10.5pt;">:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">#include <iostream></span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">using namespace std;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">class Time;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">class Date</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {public:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Date(int,int,int);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> friend Time;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">private:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int month;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int day;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int year;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> };</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">Date::Date(int m,int d,int y):month(m),day(d),year(y){ }</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">class Time</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {public:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Time(int,int,int);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> void display(const Date &);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> private:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int hour;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int minute;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> int sec;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> };</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">Time::Time(int h,int m,int s):hour(h),minute(m),sec(s){ }</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">void Time::display(const Date &d)</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> cout<<d.month<<"/"<<d.day<<"/"<<d.year<<endl;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> cout<<hour<<":"<<minute<<":"<<sec<<endl;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> }</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">int main()</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">{</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Time t1(10,13,56);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Date d1(12,25,2004);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> t1.display(d1);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> return 0;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">}</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> </span><span style="font-family:Calibri;font-size: 10.5pt;">12</span><span style="font-family:宋体;font-size: 10.5pt;">:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">#include <iostream></span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">using namespace std;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">template<class numtype></span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">class Compare</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {public:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Compare(numtype a,numtype b);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> numtype max();</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> numtype min();</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> private:</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> numtype x,y;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> };</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">template <class numtype></span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">Compare<numtype>::Compare(numtype a,numtype b)</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {x=a;y=b;}</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">template <class numtype></span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">numtype Compare<numtype>::max()</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {return (x>y)?x:y;}</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">template <class numtype></span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">numtype Compare<numtype>::min()</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> {return (x<y)?x:y;}</span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"></span><span style="font-family:Calibri;font-size: 10.5pt;">int main()</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">{Compare<int> cmp1(3,7);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> cout<<cmp1.max()<<" is the Maximum of two integer numbers."<<endl;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> cout<<cmp1.min()<<" is the Minimum of two integer numbers."<<endl<<endl;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Compare<float> cmp2(45.78,93.6);</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> cout<<cmp2.max()<<" is the Maximum of two float numbers."<<endl;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">cout<<cmp2.min()<<" is the Minimum of two float numbers."<<endl<<endl;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> Compare<char> cmp3('a','A');</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> cout<<cmp3.max()<<" is the Maximum of two characters."<<endl;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> cout<<cmp3.min()<<" is the Minimum of two characters."<<endl;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;"> return 0;</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"><span style="font-family:Calibri;font-size: 10.5pt;">}</span><span style="font-family:Calibri;font-size: 10.5pt;"></span></p><p class="MsoNormal"></p><pre class="cpp" name="code">