.


:




:

































 

 

 

 


.NetFramework. Microsoft (Microsoft Intermediate Language, MSIL).




-.

-. - . - . . . , . Internet Java. Java - , ++. . .- . . . . - - Java. Java ,. ( ).

Java , -. - Java (JavaVirtualMachine JVM) . . . Java . #. - - . , -. , . , : 1. , 2. , . - . . Java Windows . . . 90- #. # , . . C# . - - # - . .-. - -. . -.NET. 1) . . -. 2) - - . - (. .NET) 3) .NET. . .

2. .NET? Windows.

.NET, Microsoft, Internet. .NET , Internet.

Microsoft.NET , . .NET Microsoft.

. -.NET. 1). . -. 2) - - . - (. .NET) 3) .NET. . . 4) Win32.API (ApplicationProgrammingInterface Windows, 1000 )

Windows. 1) Win32API. 2)VisualBasi , -. 3) ++ MFC(MicrosoftFoundationClasses, ). 3) MicrosoftComponentObjectModel - -. ATL.

Windows. , ( .DLL .EXT), , . , , .

.NET: 1) Windows.Forms ( , .NET). Windows. Forms , Web. Windows.Forms Web- , ADO.NET . 2) Web- . Web- , , Web-.

Web- , Internet-. Web- , - . Web- Windows- (, ). -. - .NET, (.NET) Web- .

Web- , Web- , Web- , :

;

FTP;

..

 


 

3. .Net. .NET Framework?

Microsoft.NET : 1) .Net (.NET FrameWork) . - (VisualStudio); 2) .NET;
3) . - ; 4) ;

.NET . -. . :.NETFrameWork, VisualStudio.NET ( VS2005), EnterpriseServers ( Web). EnterpriseServers :

MSExchange 2000 Server - ;

MSMobileInformation 20010 Server - - . -, . .;

MSSQLServer 2000 -, . , . - Web-.

.Net. ..NET - . Internet. Internet - . .

. - . .NET Internet, . -. . -. , , .

. .NET. .

.NetFramework? .NET, , . , Windows..NETFramework Windows, .. , , . C# Microsoft , .NETFramework. , C#. .NET Framework. -CommonLanguageRuntime(CLR) ; - B (BaseFramework); - () (Application Framework)

.NetFramework. Microsoft (Microsoft Intermediate Language, MSIL).

. . -. ..NET-. .- , , . , - MS MSIL -, . .

CLR: - . -. , . MSIL, . .JIT(just-in-time)- . - , CLR-. .NET , . CLR. . - , DLL LIB, DLL . .NET - - -, - (assembly). - - .NET . , . IL. L, . , . , . (manifest) , . , , , . . , . . , - - . . . , . .

 

 

5. . #. - .

# . - . # - , System.

#

# .
Sbyte Sbyte -128+128 1
Byte Byte 0255 1
Short Int16 -3276832667 16 (2 )
Ushort Uint26 065535 16
Int Int32 -21474836482147483648 32
Uint Uint32 04294967295 32
Long Uint64 018446744073709551615 64
Ulong   02^64-1 64 8
Char Char 2 . 16
Float Single -3.40282e+0383.40282e+038 . . .32 4
Double Double -1.79769e+3081.79769e+308 . . .64 8
Bool Boolean True or False
decimal Decimal 10^010^28 12
String String .
Object Object . . System.Objekt .

(0- , false-bool,null string, object; ).

. . Int32 -Parse(string) string .

 

 


6. -. . System. Math. System Math

Math - . . , Pow . X Y. , . -. , . -. Math . . -. . . , E PI, 23 . . :

. - - Sin, Cos, Tan;

. . - - ASin, ACos, ATan, ATan2 (sinx, cosx);

. - - Tanh, Sinh, Cosh;

. - - Exp, Log, Log10;

, , - Abs, Sqrt, Sign;

- - Ceiling, Floor, Round;

, , , - Min, Max, Pow,

IEEERemainder.

C#

Console.Read() 1

Console.ReadLine() , Parse(string).

:

1) stringst;

2) Console.ReadLine() st=console.ReadLine();

3) , : intx=Int32.Parse(st)


 

7. . . C#.

.

+ , . , . A =X + Y;

- , . , . A =Result-1;

* , . , . A =P * I;

(/) . . . , 5 2 2. 5 / 2, modulo (%). , float double. , , .

Console.WriteLine(5/2);Console.WriteLine(5 % 2);Console.WriteLine(5 / 2.1); Console.WriteLine(5.1 / 2);Console.WriteLine(-5 / 2);: 2 1 2.38095238095238 2.55 2

% - A:=Y % 6;

15 / 4 = 3 5 / 9 = 0 7 / 7 = 1 9 / 8 = 1 24 % 6 = 0 24 % 7 = 3 7 % 7 = 0 8 % 12 = 8

.

+ () , . , . A =+7;

- () , . , . A =-X;

(++) 1. , . . . . . . , , ++. .

doublex;x = 1.5;Console.WriteLine(++x); // 2.5 x = 1.5;Console.WriteLine(x++); // 1.5 Console.WriteLine(x); // 2.5

(--) 1. , : --variable variable--.

:+= -= *= /= %=

: i += 7 * j; // i = i + 7 * j; m /= 3 + k; // m = m / (3 + k);

: 1) , //; 2) , /* */.

C#. .

&& (AND)
|| (OR)
! (NOT)

1. : . .

2. : , (if, if-else, switch, while, do-while, for) .

3. : , . goto. , . (:). . -. : ABC2: x=3;

4. : () . , . ({}). (;).

5. -: , (;), .

: (;). .

6. break:

break;

switch, while,do for.

, . - .

7. return:

Return;

.

return ; .

if-else:if( ) <>;

, <>. , . if () <1>else<2>;

8. - switch:

switch () { case 1: <;>break;

case 2: <;>break;

default: <;>break; }

, .

9. while: while ( ) { <;> }

13, do while: Do<>while ( );

10. for:for (1; 2; 3) { <;> }

11. : . , # .


 

8. C#. System.Random, . System.Array, Length.

# . System. Array. - , - - . . , . - . .

# . , . , .

2 - : 1) - , , . : _[] _; : int [] mas1; 2) , .. . _[] _ = new_[-_]; . - -, , . , : mas1=newint[n].

. Random. Main(): RandomOb=newRandom(); 2 : (publicRandom() ), publicRandom (intx) . , .

( ): 1) publicintNext() int. 2) publicintNext (intmax) 0 max, max. 3) publicintNext(intmin, intmax) min max.

-RANDOM: for (i=0; i<n; i++) mas [i]=(float)(Ob.Next(100)+Ob.NextDouble());Console.WriteLine(:); for (i=0; i<n; i++) Console.Write({0:#.##} ,mas[i]); Console.WriteLine();

System.Array, Length. . , Array.Sort(_), . Array.Revers(_), . - Length, - . for(i=0; i<mas.Length; i++) Array.Sort(mas);

System.Array : ICloneable, IList, ICollection, IEnumerable, , , -. Array . -.

 


9. C#. ; ;

- , . , , , . , n m , , i- j- a[i,j].

# - . . . . [ ] . , , 10Ï20 : int [,] Matrix = newint[10,20]; //

: 3Ï4 1 12

using System; Class Dwumas

{ public static void Main() { int i, j; int [,] Matr = new int [3,4];

for (i = 0; i < 3; i + +) { for (j = 0; j < 4; j ++) { Matr [i,j] = (i*4) + j + 1;

Console. Write(Matr [i,j] + ); } Console. WriteLine(); }

foreach.

foreach :

using System; class use mas { static void Main() {

Console. WriteLine( );

int n = int32. Parse(Console. ReadLine());

int [ ] Mas = new int [n]; for (int k = 0; k < n; k + +)

{ Console. WriteLine();

Mas [k] = int32.Parse(Console. ReadLine()); }

foreach(int z in Mas) Console. WriteLine( {0}, z); } }

. - - . - , -. - . . . [a,b]. [a,b] . , a - , b - . . , - . . . , , , . . . .

C# . - .

1) int [] k = new int [2, 3]

2) int[,] k = {{ 2, -2 }, { 3, -22 }, { 0, 4 }};

- . : string [,] ( ). - . .

. :
// 2- int[][] k = new int [2][];

, ( ). - , . .
. , , .

 

:

for (kk = 0; kk < n; kk++) { for (mm = 0; mm < n; mm++) Console.WriteLine(mas[kk, mm] + " "); }

 

10. C#. , , .

, , . , , , , , , . . , . . , . . . , , . , , , . struct. [<><>struct<>: <>< >;]: usingSystem;ClassusesStruct

{ struct point

{ public double x,y;

public point (double x, double y)

{ this.x = x;

this.y = y;}

}

static void Main ()

{ point [ ] pt = new point [5];

for (int i = 0; i < 5; i + +)

{ pt [i] = new point (i, i+2);

Console. Writeline ({0}, i);

Console. Writeline ( x = {0}, pt [i].x);

Console. Writeline ( y = {0}, pt [i].y); }

} }

# (sbyte, int, long), . . System. . . , , System. Object.

 





:


: 2016-10-06; !; : 510 |


:

:

, .
==> ...

1924 - | 1751 -


© 2015-2024 lektsii.org - -

: 0.091 .