PHP Code:
#include <iostream>
#include <fstream>
using std::istream;
using namespace std;
class DT
{
int n;
int a[20];
public:
friend istream& operator>>(istream& is, DT &);
void insl();
};
istream& operator>>(istream& is, DT &d)
{
cout<<"Bac cua da thuc: "; is>>d.n;
cout<<"\nCac he so:";
for(int i=0;i<=d.n;i++)
{
cout<<"\na"<<i<<"="; is>>d.a[i];
}
return is;
}
void DT::insl()
{
cout<<n<<"\n";
for(int i=0;i<n;i++)
cout<<a[i]<<" ";
}
int main()
{
DT p;
cout<<"Nhap da thuc P:\n"; cin>>p;
p.insl();
system("pause");
}
Mình đã sữa lại cho nó chạy được, còn phần giải thích thì có lẽ mình sẽ post sau, bạn xem lại nhé !