.


:




:

































 

 

 

 


public_static_void_Mov ( int x, int y, int d)




{

x=x+d;

y=y+d;

}

 

public_static_void_Main()

{

int a=4, b=3, d=10;

Move (a, b, d); //

}

}

, . - .

 

 

. return ;

. , .. :

1. (, ..)

2. (.. )

3.

.

.

class_Example

{

public_static_int_Mov (int x, int y, int d) //

{ int k; //

x=x+d;

y=y+d;

k=x+y; // ,

return k; //

}

 

public_static_void_Main()

{

int a=4, b=3, d=10, k;

k=Move (a, b, d); // , k

}

}

, , . : - , , . :

k= 5/ 2.0 + Move (a, b, d);

Main()

Main() , . , , . . ! . , .

Main
 
 
 
 
 

 


, . Main() , .

. , .

:
PR
PR
BIN
DEBUG
pr.sln ()
pr.exe

 

 


C:\PR\PR\BIN\DEBUG\pr.exe_1_ 2_... _N

Main : Main (string[] args)

. .

, .

Plus

Minus

pr.exe.

1.

2.

( ) +

( )

3. ()

C:\PR\PR\BIN\DEBUG\pr.exe_50__

 

50
   
args Main()

 

 

public static void Plus(double[] p, double s)

// , ,

{

for (int i = 0; i < p.Length; i++)

p[i] += s;

}

public static void Minus(double[] p, double s)

{

for (int i = 0; i < p.Length; i++)

p[i] -= s;

}

public static Main(string[] args)

{

double[] pr; //

double delta; //

string key = ""; //

pr = new double[] { 100.0, 200.0, 300.0 };

//

if (args.Length!= 3) return;

// - 1

//

if (args[2]!= key) return;

// - 2

//

delta = double.Parse(args[0]);

//

switch (args[1].ToUpper())

{

case "":

case "+": Plus(pr, delta); break;

case "":

case "-": Minus(pr, delta); break;

}

//

return;

}

, , , . .

, -.

, , :

1. , , .

2. , , ,

3. , .

, , , :

-

-

-

-

class Program

{

public static void Main()

{

double d; //

double x, y, h

//

public void Set(double xp)

{

x = xp; y = 0; h = 0;

}

//

public void Set(double xp, double yp)

{

x = xp; y = yp; h = 0;

}

//

public void Set(double xp, double yp, double hp)

{

x = xp; y = yp; h = hp;

}

//

public double Dist()

{

return Math.Sqrt(x * x + y * y + h * h);

}

}

Set(2.0); // Set()

d=Dist(); // d=2.0

Set(3.0,4.0); // Set()

d=Dist(); // d=5.0

Set(2,3,6); // Set

d=Dist(); // d=7.0

}

}

. , . . Math, : .

 

. :

, , .

(.. ) , , .

,

 

:

1. , , void. , .

2. , , . , ..

3. , , .

4. , .

5. .





:


: 2017-03-12; !; : 194 |


:

:

.
==> ...

1567 - | 1437 -


© 2015-2024 lektsii.org - -

: 0.016 .