: (47617)


1

2

3

4

5

6



1


: . ᒺ .

, , ( ). . , , , : ᒺ, , , , . ϳ ᒺ ᒺ .


2


, .

, . . , . .

³ :

;

;

.

:

ᒺ ;

;

;

;

.

ᒺ : , .

: , .

, , .

, , , .


3


, . , , , .

:

;

;

;

;

.

ᒺ . .

Input. ֳ . , , .

, , . .

ToString.

:

ᒺ +. + , . , . . ᒺ .

*. * , , . . .

. . , . . .

^. ^ , , . . .

/. / , . . .

, # .


4


, .

, -, Ք . . privt, , , , . -, , .

, ᒺ, , . , .

. Input. : . : . , . , . , .

ToString. , , .

ᒺ +. , . ᒺ . . , , . , . .

*. . , , . , . .

. , . . , , . , . .

^. . , , . , , . , . .

/. , . . , , tru, fls.

ij .

1.


1


, Clss 1 ( ) Consol . Clss 1 ᒺ St . , St. rry St, rry St . St ᒺ . .


5


, .

1. :


St st11 = nw St(kil11);


ᒺ st11 St kil11 , . ᒺ St.


St.Input(st11, "SI");


Input St , st11 ᒺ St, SI . ᒺ.

2. :


St st13 = st11 + st12;


ᒺ st13. + ᒺ st13. ᒺ +, ᒺ st11 i st12.


St st23 = st21 * st22;


ᒺ st123. * ᒺ st23. ᒺ *, st21 i st22.


St st33 = st31 st32;


ᒺ st133. - ᒺ st33. ᒺ -, st31 i st32.


St st43 = st41 ^ st42;


ᒺ st143. ^ ᒺ st43. ᒺ ^, st41 i st42.

3. :


bool s = st51 / k51;

if (s)


Consol.WritLin(" : {0} SI", k51);

ls Consol.WritLin(" : {0} SI", k51);

s / k51 st51. / s: tru fls. . tru , fls .

4. :


Consol.WritLin("SI: {0}", st11);

Consol.WritLin("SII: {0}", st12);

Consol.WritLin("ᒺ SI i SII: {0}", st13);


: ᒺ st11, st12, st13 . ᒺ ToString.


6


St.cs:

using Systm;

using Systm.Collctions;


nmspc MySt

{

public clss St

{

rry X;


public St(int x)

{

this.X = nw int[x];

}


// -------------------- -------------------

public sttic St oprtor + (St s1, St s2)

{


try

{

rryList rlist1 = nw rryList();


//rry.Sort(s1.X);

for (int i=0; i

{

rlist1.dd(s1[i]);

}


bool flg=fls;

//rry.Sort(s2.X);

for (int i=0; i

{

for (int j=0; j

{

flg=fls;

if(s2[i]==(int)rlist1[j])

{

flg=tru;

brk;

}

}

if (!(flg)) rlist1.dd(s2[i]);

}


St s3 = nw St(rlist1.Count);

for(int i=0; i

s3[i]=(int)rlist1[i];

rturn s3;

}

ctch (xcption )

{

Consol.WritLin(.Mssg);

rturn null;

}

}


// --------------------- ---------------------

public sttic St oprtor * (St s1, St s2)

{

try

{

rryList rlist2 = nw rryList();


//rry.Sort(s1.X);

//rry.Sort(s2.X);

for (int i=0; i

{

for (int j=0; j

{

if(s1[i]==s2[j])

{

rlist2.dd(s1[i]);

brk;

}

}

}



St s3 = nw St(rlist2.Count);

for(int i=0; i

s3[i]=(int)rlist2[i];

rturn s3;

}

ctch (xcption )

{

Consol.WritLin(.Mssg);

rturn null;

}

}


// --------------------- ii ---------------------

public sttic St oprtor - (St s1, St s2)

{

try

{

rryList rlist3 = nw rryList();


//rry.Sort(s1.X);

//rry.Sort(s2.X);

bool flg=fls;

for (int i=0; i

{

for (int j=0; j

{

flg=fls;

if (s1[i]==s2[j])

{

flg=tru;

brk;

}

}

if (!(flg)) rlist3.dd(s1[i]);

}


St s3 = nw St(rlist3.Count);

for(int i=0; i

s3[i]=(int)rlist3[i];

rturn s3;

}

ctch (xcption )

{

Consol.WritLin(.Mssg);

rturn null;

}

}


// --------------------- ii ---------------------

public sttic St oprtor ^ (St s1, St s2)

{

try

{

rryList rlist3 = nw rryList();


//rry.Sort(s1.X);

//rry.Sort(s2.X);

bool flg=fls;

// -------------------------- s1 - s2-------------------

for (int i=0; i

{

for (int j=0; j

{

flg=fls;

if (s1[i]==s2[j])

{

flg=tru;

brk;

}

}

if (!(flg)) rlist3.dd(s1[i]);

}


// -------------------------- s2 - s1----------------------

for (int i=0; i

{

for (int j=0; j

{

flg=fls;

if (s2[i]==s1[j])

{

flg=tru;

brk;

}

}

if (!(flg)) rlist3.dd(s2[i]);

}



St s3 = nw St(rlist3.Count);

for(int i=0; i

s3[i]=(int)rlist3[i];

rturn s3;

}

ctch (xcption )

{

Consol.WritLin(.Mssg);

rturn null;

}

}


//------------- -----------------

public sttic bool oprtor / (St s1, int k)

{

bool flg=fls;

for (int i = 0; i < s1.X.Lngth; i++)

{

if (k==s1[i])

{

flg = tru;

brk;

}


}

rturn flg;

}



//------------------------- ------------------------


public sttic void Input (St s, string str)

{

try

{

pov0: Consol.WritLin("-------- {0} i --------", str);

Rndom rn = nw Rndom();


Consol.WritLin("\t 1 - ");

Consol.WritLin("\t 2 - i\n");

Consol.Writ("i ");


string ss = Consol.RdLin();


for (int i=0;i

if ((ss[i]!='1')&&(ss[i]!='2')&&(ss[i]!='3')&&(ss[i]!='4')&&(ss[i]!='5')&&(ss[i]!='6')&&(ss[i]!='7')&&(ss[i]!='8')&&(ss[i]!='9')&&(ss[i]!='0'))

{

Consol.WritLin("Invlid vlu!");

goto pov0;

}



int ction= Convrt.ToInt32(ss);

if ((ction!=1) && (ction!=2)) goto pov0;



switch(ction)

{

cs 1:

int min =0, mx=s.X.Lngth+s.X.Lngth;

for (int i = 0; i < s.X.Lngth; i++)

{

pov1: int rr=rn.Nxt(min, mx);

if(s/rr==tru) goto pov1; // - / -

ls s[i]=rr;

}


brk;


cs 2:

Consol.WritLin("-------- {0} --------", str);

for (int i = 0; i < s.X.Lngth; i++)

{

pov2: Consol.Writ("s[{0}] ",i);

int r = int.Prs(Consol.RdLin());

if (s/r==tru)

{

Consol.WritLin("This lmnt lrdy xists!");

goto pov2;

}

ls s[i]=r;

}

brk;

}

}

ctch (xcption )

{

Consol.WritLin(.Mssg);

}

}


//----------------------- Output----------------------------

/*public sttic void Output (St s, string str)

{

try

{

Consol.Writ("{0}: ", str);

for (int i = 0; i < s.X.Lngth; i++)

Consol.Writ("{0:N0} ", s[i]);

Consol.WritLin();

}

ctch (xcption )

{

Consol.WritLin(.Mssg);

}

}*/


public ovrrid string ToString()

{

string s="";

for(int i=0;i

s+=" "+X.GtVlu(i);

rturn s;

}


//---------------------------------------------------

public int this [int i]

{

gt

{

if ((i<0) || (i>X.Lngth)) throw nw IndxOutOfRngxcption("I i !");

rturn (int)X.GtVlu(i);

}

st

{

if ((i<0) || (i>X.Lngth)) throw nw IndxOutOfRngxcption("I i !");

X.StVlu(vlu, i);

}

}


}

}

lss1.cs:


using Systm;


nmspc MySt

{


clss Clss1

{


sttic void Min(string[] rgs)

{

whil (tru)

{

try

{

Consol.WritLin("---------------------------------------------------------");

Consol.WritLin(" I ");

Consol.WritLin("---------------------------------------------------------");

Consol.WritLin("\t 1 - ");

Consol.WritLin("\t 2 - ");

Consol.WritLin("\t 3 - i ");

Consol.WritLin("\t 4 - i ");

Consol.WritLin("\t 5 - i i i");

Consol.WritLin("\t 0 - i");

Consol.WritLin("---------------------------------------------------------");

Consol.Writ("i ");


int ction=int.Prs(Consol.RdLin());

switch(ction)

{

cs 1://

pov0: Consol.Writ("i - i SI: ");

string ss = Consol.RdLin();


for (int i=0;i

if ((ss[i]!='1')&&(ss[i]!='2')&&(ss[i]!='3')&&(ss[i]!='4')&&(ss[i]!='5')&&(ss[i]!='6')&&(ss[i]!='7')&&(ss[i]!='8')&&(ss[i]!='9')&&(ss[i]!='0'))

{

Consol.WritLin("Invlid vlu!");

goto pov0;

}


int kil11 = Convrt.ToInt32(ss);

St st11 = nw St(kil11);

St.Input(st11, "SI");


Consol.Writ("i - i SII: ");

int kil12 = int.Prs(Consol.RdLin());

St st12 = nw St(kil12);

St.Input(st12, "SII");


St st13 = st11 + st12;


// Output

/*St.Output(st11, "SI");

St.Output(st12, "SII");

St.Output(st13, " SI i SII");*/


Consol.WritLin("SI: {0}", st11);

Consol.WritLin("SII: {0}", st12);

Consol.WritLin(" SI i SII: {0}", st13);

brk;


cs 2://

pov1: Consol.Writ("i - i SI: ");

string ss1 = Consol.RdLin();


for (int i=0;i

if ((ss1[i]!='1')&&(ss1[i]!='2')&&(ss1[i]!='3')&&(ss1[i]!='4')&&(ss1[i]!='5')&&(ss1[i]!='6')&&(ss1[i]!='7')&&(ss1[i]!='8')&&(ss1[i]!='9')&&(ss1[i]!='0'))

{

Consol.WritLin("Invlid vlu!");

goto pov1;

}


int kil21 = Convrt.ToInt32(ss1);

St st21 = nw St(kil21);

St.Input(st21, "SI");


Consol.Writ("i - i SII: ");

int kil22 = int.Prs(Consol.RdLin());

St st22 = nw St(kil22);

St.Input(st22, "SII");


St st23 = st21 * st22;


// Output

/*St.Output(st21, "SI");

St.Output(st22, "SII");

St.Output(st23, " SI i SII");*/

Consol.WritLin("SI: {0}", st21);

Consol.WritLin("SII: {0}", st22);

Consol.WritLin(" SI SII: {0}", st23);

brk;


cs 3:// i

pov2: Consol.Writ("i - i SI: ");

string ss2 = Consol.RdLin();


for (int i=0;i

if ((ss2[i]!='1')&&(ss2[i]!='2')&&(ss2[i]!='3')&&(ss2[i]!='4')&&(ss2[i]!='5')&&(ss2[i]!='6')&&(ss2[i]!='7')&&(ss2[i]!='8')&&(ss2[i]!='9')&&(ss2[i]!='0'))

{

Consol.WritLin("Invlid vlu!");

goto pov2;

}


int kil31 = Convrt.ToInt32(ss2);

St st31 = nw St(kil31);

St.Input(st31, "SI");


Consol.Writ("i - i SII: ");

int kil32 = int.Prs(Consol.RdLin());

St st32 = nw St(kil32);

St.Input(st32, "SII");


St st33 = st31 - st32;


// Output

/*St.Output(st31, "SI");

St.Output(st32, "SII");

St.Output(st33, "i SI i SII");*/

Consol.WritLin("SI: {0}", st31);

Consol.WritLin("SII: {0}", st32);

Consol.WritLin("i SI SII: {0}", st33);

brk;


cs 4:// i

pov3: Consol.Writ("i - i SI: ");

string ss4 = Consol.RdLin();


for (int i=0;i

if ((ss4[i]!='1')&&(ss4[i]!='2')&&(ss4[i]!='3')&&(ss4[i]!='4')&&(ss4[i]!='5')&&(ss4[i]!='6')&&(ss4[i]!='7')&&(ss4[i]!='8')&&(ss4[i]!='9')&&(ss4[i]!='0'))

{

Consol.WritLin("Invlid vlu!");

goto pov3;

}


int kil41 = Convrt.ToInt32(ss4);

St st41 = nw St(kil41);

St.Input(st41, "SI");


Consol.Writ("i - i SII: ");

int kil42 = int.Prs(Consol.RdLin());

St st42 = nw St(kil42);

St.Input(st42, "SII");


St st43 = st41 ^ st42;


// Output

/*St.Output(st41, "SI");

St.Output(st42, "SII");

St.Output(st43, "i SI i SII");*/

Consol.WritLin("SI: {0}", st41);

Consol.WritLin("SII: {0}", st42);

Consol.WritLin("i SI SII: {0}", st43);

brk;



cs 5://

pov5: Consol.Writ("i - i SI: ");

string ss3 = Consol.RdLin();


for (int i=0;i

if ((ss3[i]!='1')&&(ss3[i]!='2')&&(ss3[i]!='3')&&(ss3[i]!='4')&&(ss3[i]!='5')&&(ss3[i]!='6')&&(ss3[i]!='7')&&(ss3[i]!='8')&&(ss3[i]!='9')&&(ss3[i]!='0'))

{

Consol.WritLin("Invlid vlu!");

goto pov5;

}


int kil51 = Convrt.ToInt32(ss3);

St st51 = nw St(kil51);

St.Input(st51, "SI");


pov6: Consol.Writ("i i: ");

string sss = Consol.RdLin();


for (int i=0;i

if ((sss[i]!='1')&&(sss[i]!='2')&&(sss[i]!='3')&&(sss[i]!='4')&&(sss[i]!='5')&&(sss[i]!='6')&&(sss[i]!='7')&&(sss[i]!='8')&&(sss[i]!='9')&&(sss[i]!='0'))

{

Consol.WritLin("Invlid vlu!");

goto pov6;

}



int k51 = Convrt.ToInt32(sss);


bool s = st51 / k51;


// Output

//St.Output(st51, "SI");

Consol.WritLin("SI: {0}", st51);


if (s)

Consol.WritLin(" : {0} i SI", k51);

ls Consol.WritLin(" : {0} i SI", k51);

brk;

}

if (ction==0) brk;


}

ctch (xcption )

{

Consol.WritLin(.Mssg);

}

}


}

}

}


29