Информатика и технология программирования


Вопросы без ответов - часть 3


strcpy(x.s, s);
strcat(x.s, t);
return(x);
}
void main()
{ strings x("abcd"),y,z; y = x + "11"; z = x + "22"; }
//----------------------------------------------------- 10


strings strings::operator+(strings t)
{ strings x;
x.s = new char[strlen(s)+strlen(t.s)+1];
strcpy(x.s, s);
strcat(x.s, t.s);
return(x);
}
void z10() { strings x("abcd"),y("111"),z; z = x + y + x; }
//------------------------------------------------------ 11


class matrix
{
int n,m;
int *area;
public:
matrix(int,int);
int operator()(int,int);
int operator()(int,int,int);
};
matrix::matrix(int nn, int mm)
{ n = nn; m = mm; area = new int[n * m]; }


int matrix::operator()(int nn,int mm)
{ return (area[nn * m + mm]); }


int matrix::operator()(int nn,int mm, int val)
{
area[nn * m + mm] = val;
return(val);
}
void main() {
matrix x(10,10); x(5,5,12); x(6,6,x(5,5));
x(6,6,x(6,6)+10); }
//----------------------------------------------------- 12


class matrixs
{
int n,m;
int *area;
public:
matrixs(int,int);
int &#38operator()(int,int);
};
matrixs::matrixs(int nn, int mm)
{ n = nn; m = mm; area = new int[n * m]; }


int &#38matrixs::operator()(int nn,int mm)
{ return (area[nn * m + mm]); }


void main() { matrixs x(10,10); x(5,5) = 10;
x(6,6) = x(5,5) + 10; x(6,6)++; }




Начало  Назад  Вперед



Книжный магазин