#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class
PS
{ int tu, mau;
public:
PS ();
void xuat();
void nhap();
void
operator*=( PS&);
PS
operator+(PS&);
int
operator>(PS&);
};
PS::PS()
{ tu=0; mau=1;};
void PS::nhap()
{ cout<<"\n tu:"; cin>>tu;
cout<<"\n mau:"; cin>>mau;
};
void PS:: xuat()
{ cout<
void PS::operator*=(PS&c2)
{ tu=tu*c2.tu;
mau=mau*c2.mau;
};
PS PS::operator+( PS&c2)
{ PS temp;
temp.tu=tu*c2.mau+mau*c2.tu;
temp.mau=mau*c2.mau;
return temp;
};
int PS:: operator>(PS&c2)
{ if((tu/(mau*1.0))>(c2.tu/(c2.mau*1.0)))
return 1;
return 0;
};
void nhap( PS a[], int k)
{ for( int i=0; i
{cout<<"\n phan tu thu:"<
a[i].nhap();
};
};
PS
tong( PS a[], int k)
{ PS temp=a[0];
for( int i=1; i
temp=temp+a[i];
return temp;
};
PS
tich( PS a[], int k)
{ PS temp; temp=a[0];
for( int i=1; i
{temp*=a[i];};
return temp;
};
PS timmin( PS a[],int k)
{ PS temp=a[0];
for( int i=1; i
{ if(temp>a[i])
temp=a[i];
};
return temp;
};
void main()
{ clrscr();
PS a[100]; int n;
cout<<" so cac phan so la:";
cin>>n;
nhap(a,n);
cout<<" tong cac phan so la:";tong(a,n).xuat();
cout<<"\n tich cac phan so la:"; tich(a,n).xuat();
cout<<"n phan so nho nhat la-:"; timmin(a,n).xuat();
getch();
}