ֲ ί 5
Ѳ ò
̲Ͳ , . 2
6.170101
6.170102
6.170103
2015
ᒺ- . , , . : 5 㳿 , .2 6.170101 , 6.170102 , 6.170103 . / .: .. , .. , .. - : , 2015.- 16 .
: .. , ..., ,
.. , ..., ,
.. , .
ᒺ- C#. .
1. Ͳ Ͳ ²Ҳ
# ᒺ- (). ᒺ- # #- ᒺ . , #-, .
ᒺ- ϖ, #, : , .
, (䳿) , , . ᒺ- , . . ᒺ. , ᒺ , .
, ᒺ . ᒺ . , , ᒺ. , ( , ᒺ) . ᒺ .
# . ᒺ. ³ , , . # ᒺ. ᒺ . , , , ᒺ.
|
|
, , . , (instance variable), , , - (member method), . - , # . ++, , , , # , /++ . # ++, , , C#-.
. , , , , . , . , , . , . # , .
. , .
ᒺ . .
, ᒺ . ᒺ , , ᒺ .
# ', , , . . . , . , max_a. # . , . # ( # 77 ).
, // /// , #. // /// .
const . .
const int a=100 // .
# , # . , . . , , .
|
|
# .
# .1
1
bool | , , / |
byte | 8- |
char | |
decimal | |
double | |
float | |
int | ֳ |
long | |
sbyte | 8- |
short | |
uint | ֳ |
ulong | |
ushort |
.2:
2
ij | ||
byte | 0 255 | |
sbyte | -128 127 | |
short | -32768 326767 | |
ushort | 0 65535 | |
int | -2 147 483 648 2 147 483 647 | |
uint | 0 4 294 967 295 | |
long | -9 223 372 036 854 775 808 9 223 372 036 854 775 807 | |
ulong | 0 18 446 744 073 709 551 615 |
.3:
3
ij | ||
double | ³ 1.5*10-45 3.4*1038 | |
float | ³ 5*10-324 1.7*10308 |
.4.
4
ESC- | |
\a | () |
\b | |
\f | ( ) |
\n | |
\r | |
\t | |
\v | |
\0 | |
\ | () |
\ | |
\\ |
# .5:
5
IJ | |
+ | |
- | ³, |
* | |
/ | ij |
% | ij |
-- | |
++ |
ij # +,-,* / 䳺 - . .
. 6:
6
== | г |
!= | |
> | |
< | |
>= | |
<= |
.7:
7
& | |
| | |
^ | |
&& | |
|| | |
! | Ͳ |
boolean.
:
(=). :
= ;
.
8 #. ( , , )
8
+ ! ~ | |
/ | * / % |
/ | + - |
<< >> | |
³ | < > <= >= |
==!= | |
AND | & |
XOR | | |
OR | ^ |
AND | && |
OR | || |
= += -= *= /= %= .. |
|
|
.
, . : internal, private, protected public. , protected internal. , .9:
9
г | |
public | - |
internal | - |
protected | . |
protected internal | |
private |
.
, ᒺ. ³ , . # ᒺ. ᒺ . , (), , ᒺ.
, , , , .
class. :
lass
{
//
1;
2;
//
N;
//
_ 1 ()
{
//
}
_ 2 ()
{
//
}
//
_ N ()
{
//
}
}
(, public), . , , , , (private). .
, .
ᒺ
# (int, char .) . ᒺ , new:
Time t = new Time()
t ᒺ Time, ᒺ (). t ᒺ.
ᒺ . ij . ³ . , ᒺ . ᒺ , ' .
Math
Math . Math .10:
10
Abs (x) | x |
Acos (x) | x |
Asinx (x) | x |
Atan (x) | x |
Log (x) | |
Log (x,y) | |
Log10 () | 10 |
Max (x,y) | x, y |
Min (x,y) | , |
Pow (x,y) | |
Round (x) | |
Sin (x) | |
Sinh (x) | |
Tan (x) | |
Tanh (x) |
2. ٲ #
|
|
Visual Studio 2005. Visual Studio 2005 →→Microsft Visual C# 2005 Express Edition, , .1.
.1. Microsft Visual C# 2005 Express Edition .
. File→New→Project, Visual Studio .2.
.2. ij .
Templates Console Application, Name . , . ConsoleApplication1.
Visual Studio , . , , .
ϳ Visual Studio Program.cs. # - *.cs. Program , .
:
using...
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
}
}
}
(+) (-) . + using.... ֳ 䳺 Visual Studio , , .
, , , . , , ., +/- , #region. , #region #endregion .
.
# ConsoleApplication1.exe, Build→Build ConsoleApplication1. , . Debug→Start Without Debugging. .
DOS, Tools→Command Window. Tools, Start→All Programs→Microsoft Visual Studio 2005→Visual Studio Tools→Visual Studio 2005 Command Prompt.
.
:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{//
static void Main(string[] args)
{
//
}
}
}
, Main(), . using namespace ConsoleApplication1 {.
ҳ .
.
using System;
namespace ConsoleApplication1
{//Գ
// Program ,
class Program
{//
// Main()
static void Main(string[] args)
{//
Console.WriteLine(-, :);
//
string sName = Console.ReadLine();
//³
Console.WriteLine( , +sName);
//
Console.WriteLine( <Enter>
...);
onsole.Read();
// Main()
}//ʳ Main()
}//ʳ Program
}//ʳ ConsoleApplication1
|
|
, Main():
//
Console.WriteLine(-, :);
//
string sName = Console.ReadLine();
//³
Console.WriteLine( , +sName);
, Code Snippets ( ), , Console.WriteLine. <Ctrl+K>, <Ctrl+X> Code Snippets. cw <Enter>. Visual Studio Console.WriteLine() .
#: Console.WriteLine. -, :.
sName. , .
, <Enter>.ֳ , .