Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Osnovy_programirovanniya_na_S_

.pdf
Скачиваний:
14
Добавлен:
02.02.2015
Размер:
3.52 Mб
Скачать

- , , -

.

2..

.

4.,

( ).

5..

-

.

, -

-

. -

.

-

. -

, -

.

, -

, , -

: . « -

». -

. -

. -

.

21

1.

C# ,

.

1.

.

C# , -

System. -

, string System.String, int

System.Int32. -

: ; ; -

1.1

 

 

 

 

 

 

 

NET

 

)

 

 

 

 

 

 

bool

System.Boolean

-

-

 

 

 

 

 

 

Int

System.Int32

 

32

 

shot

System.Int16

 

16

 

byte

System.Byte

 

8

 

sbyte

System.SByte

 

8

 

long

System.Int64

 

64

 

 

 

 

 

 

float

System.Single

7

32

 

double

System.Double

15

64

 

 

 

 

 

 

string

System.String

 

-

 

shar

System.Char

 

16

 

 

 

Unicod

 

 

 

 

 

 

 

object

System.Object

 

-

 

 

 

 

 

22

; ; (object).

1.1.

NET Framework –

System.Object. :

.

-

,

.

, . -

null. , -

, , -

.

-

, -

. .

#.

, -

, , ,

.

Visual Studio

-

, Microsoft Visual Basic, Microsoft Visual C#).

C#, -

Visual Studio, . -

# . -

C# ( -

23

Visual Studio.NET C# -

– -

cs).

,

, Main. C#

, ++,

, -. ,

, ,

.

C# Main.

,

string – ,

, .

, -

, C#-

. -

:

static void Main(string[] args)

{

}

static , Main

, -

, . , -

, void.

Main int.

1. .

static void Main()

24

{

Console.WriteLine(" !\n

\" \"!!!");

}

.

Debug\Start Without Debugging. -

. -

: Press any key to continue, .

. -

« -

» , -

.

Debug\Start Debugging,

.

, -

.

Console.Read();

-

.

int.

, ,

-12, 5, 0 ( 32 ). -

25

-12L 64 ), 5u

8 )

. -

float(32 ) , -

f F 1.2, -1.234, -

double (64 ) «d» «D»,

: 1234.5678, 12.3d.

.

.

float(32 ) ,

f F: 1.2E-3f 0.0012), -

double (64 ) -1.34E5 -134000) -

.

. char

16- Unicode (‘a’) -

( (‘\r’), (‘\f’),

(‘\t’), ), -

.

– ,

, string. ,

, !\n \" \"!!!"

. true

(« ») false (« »). C#

, .

. , -

, , -

26

const float p = 3.14159f

– , -

. -

.

,

.

.

, -

. . ,

Long, LONG, long – .

-

, .

. -

( -

).

: MaxLen, iMaxLen, Max_Len

: 2Len, Le#

:

int a = -14;

// 32

 

float c = -0.00151f;

//

 

32

 

//

 

double i = 1234.56789;

//

 

64

 

//

 

bool l = false;

// 16

 

string name = "Petrov";

//

 

27

– (

, , -

), .

 

:

 

2

* 2

+ 1

 

5

1

/ 2

– 3

 

-3

1. / 2 – 3

-2.5

-

( 1.2): y = 2*x*x + 3*x – 1.

-

« = »,

 

y.

 

:

string kaf = “ ” + “ ”;

-

, “ +

, kaf.

1.2

 

 

 

 

+

 

 

 

-

 

 

 

*

 

 

 

/

 

 

 

%

 

 

 

28

-

, , -

. -

%, 10 % 3 -

, 1.

, 10f / 3f

3,333333.

#

, Math

System.

-

, -

VS .

, . .

.

.

, , -

. , Math.Abs(),

, 7 : double Math.Abs

(double x), float Math.Abs (float x), int Math.Abs(int

x), . . ( 1.3)

1.3

 

 

 

 

 

 

1.

Math.Abs( )

 

 

 

 

29

2.Math.Ceiling( )

 

 

 

 

 

 

 

 

 

 

 

 

3.

 

Math.Cos( )

 

 

 

 

 

 

 

 

 

4.

 

Math.

 

 

 

 

 

 

 

 

 

5.

 

Math.Exp( )

 

 

 

 

 

 

 

 

 

6.

 

Math.Floor( )

 

 

 

 

 

 

 

 

 

 

 

 

 

7.

 

Math.Log( )

 

 

 

 

 

8.

 

Math.Log10( )

 

 

 

 

 

 

9.

Math.Max( 1,

 

 

 

 

 

2)

 

 

 

 

 

 

10.

Math.Min( 1,

 

 

 

2)

 

 

 

 

 

 

 

 

11.

Math.PI

 

 

 

 

 

 

12.

Math.Pow( 1,

 

 

 

2)

 

 

 

 

 

 

13.

Math.Round( )

 

 

 

Math.Round( ,

 

 

 

)

 

 

 

 

 

 

 

 

14.

Math.Sign( )

 

 

 

 

 

 

 

 

15.

Math.Sin( )

 

 

 

 

 

 

16.

Math.Sqrt( )

 

 

 

 

 

 

17.

Math. an( )

 

 

 

cos x

2. Y 1 x2 x = 2,5

using System;

using System.Collections.Generic;

30

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]