#include<iostream>
using namespace std;
class JU
{
public:
void input();
void display();
friend JU operator +(JU &c1,JU &c2);
friend ostream& operator <<(ostream &,JU&c);
friend istream& operator >>(istream &,JU&c);
private:
int ju[2][3];
};
istream& operator >>(istream &input,JU&c)
{
int i,j;
cout<<"ÇëÊäÈë¾ØÕó£º"<<endl;
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
input>>c.ju[i][j];
}
}
return input;
}
ostream& operator <<(ostream &output,JU&c)
{
int i,j;
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
output<<c.ju[i][j]<<'\t';
}
output<<endl;
}
return output;
}
JU operator +(JU &c1,JU &c2)
{
JU c;int i,j;
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
c.ju[i][j]=c1.ju[i][j]+c2.ju[i][j];
}
return c;
}
int main()
{
JU a,b;
cin>>a;
cout<<"¸Ã¾ØÕóΪ£º"<<endl;
cout<<a;
b=a+a;
cout<<"¾ØÕóÏà¼ÓΪ£º" <<endl;
cout<<b;
}
5
最新推荐文章于 2024-04-19 16:14:38 发布