#include <string>
#include <iostream>
#include <conio.h>
using namespace std;
class Table
{ public:
Table(){};
Table(string a1,string b1,int c,double d1);
friend ostream& operator <<(ostream& vivod,Table& f);
friend istream& operator >>(istream& vvod, Table& f);
Table operator +(Table& t);
Table operator =(const Table& t);
bool operator ==(Table& t);
private:
string a;
string b;
int c;
double d;
};
int main(int argc, char* argv[])
{
Table p("a","b",1,2),k,v("c","d",3,4);
k=p+v;
cout<<k;
getch();
return 0;
}
//---------------------------------------------------------------------------
Table:: Table(string a1,string b1,int c1,double d1):a(a1),b(b1),c(c1),d(d1)
{}
ostream& operator <<(ostream& vivod,Table& f)
{cout<<"Famili9 "<<f.a<<" "
<<"Inicial "<<f.b<<" "
<<"God "<<f.c<<" "
<<"Oklad "<<f.d<<"\n";
return vivod;
}
istream& operator >>(istream& vvod, Table& f)
{cout<<"Vvedite Famili9,Inicial,God,Okald ";
cin>>f.a>>f.b>>f.c>>f.d;
return vvod;
}
Table Table:: operator +(Table& t)
{ string h,l;int f;double s;
h=a+t.a;
l=b+t.b;
f=c+t.c;
s=d+t.d;
return Table(h,l,f,s);
}
bool Table:: operator ==(Table& t)
{return (a==t.a && b==t.b && c==t.c && d==t.d);
}
Table Table::operator =(const Table& t)
{ a=t.a;
b=t.b;
c=t.c;
d=t.d;
return *this;
}
Если Вы уже зарегистрированы на Портале - войдите в систему, если Вы еще не регистрировались - пройдите простую процедуру регистрации.