, .
:
enum <_> [:<_>] {<__>};
:
enum nameOfEnum {el1, el2, el3};
1. , . . Int, .
Byte:
enum nameOfEnum: byte {el1, el2, el3};
:
enum season {spring, summer, autumn, winter};
static void Main()
{
seasons season = seasons.summer;
string s;
switch (season)
{
case seasons.spring: s=; break;
case seasons.summer: s=; break;
case seasons.autumn: s=; break;
case seasons.winter: s=; break;
default: s= ; break;
}
Console.WriteLine(s);
Console.ReadLine();
}
. - , . , - , , . , , , : X Y, . , , , . .
, .
:
stract <_> {<_>};
;. . private, . public, , .
struct color {
public byte r;
public byte g;
public byte b;
public byte a;
}
color point;
p.r=125;
p.b=10;
p.g=90;
p.a=80;
struct point {
public int x;
public int y;
public color c;
}
point p;
, .
, .
struct color {
public byte r;
public byte g;
public byte b;
public byte a;
public color (byte_r, byte_g, byte_b, byte_a)
{
r=_r; b=_b; g=_g; a=_a;
}
}
color c = new color (10, 33, 69, 120);
9. : , , , . .
, . . ( ).
|
|
: , , .
, .
:
.
.
1) : +, - ( ), *, /, %
2) true false: == - ,!= - , <, >, <=, >=
3) true false: & - Ȼ, | - Ȼ, ~ - Ż ( ), && - Ȼ, || - Ȼ,! - Ż, ^ - Ȼ.
4) : >> - , << - .
5) : =, +=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>=
6) : ++ - 1, -- - 1 ( )
: c=a+b*n
static void Main(string[] args)
{
int n;
n = Convert.ToInt32(Console.ReadLine());
n = n == 0? 1: n;
Console.WriteLine("1/n="+1/n);
Console.ReadKey();
}