, ( ), :
[ ] [ ] interface _ [: ]
{ _ } ,
;
;
, :
.
, , . , .
.NET , , .
, IComparable , .
IEnumerable IEnumerator () foreach, ICloneable .
. .
, , ..
, 7 0 7 .
, , , .
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1: Form
{
interface ITextNoti
{
string Codirovanie();
string Decodirovanie();
}
class MyzikText: ITextNoti
{
string text;
static string[] codeTable =
{
"", "", "", "", "", "", "", ""
};
//
public MyzikText(string txt)
{
text = txt;
}
//
public string Codirovanie()
{
Boolean ok;
string rez = "";
string[] noti;
//
string text1 = text.ToLower();
// noti
// ,
// Split
noti = text1.Split(' ');
for (int i = 0; i < noti.Length; i++)
{
|
|
ok = false;
for (int j = 0; j < 8; j++)
if (noti[i] == codeTable[j])
{ ok = true; rez = rez + " " + j.ToString(); }
if (ok == false) rez = rez + "?";
}
return rez;
}
// text
//
public string Decodirovanie()
{
Boolean ok;
string rez = "";
string[] noti;
//
string text1 = text.ToLower();
noti = text1.Split(' ');
for (int i = 0; i < noti.Length; i++)
{
ok = false;
for (int j = 0; j < 8; j++)
if (Convert.ToInt32(noti[i]) == j)
{ ok = true; rez = rez + " " + codeTable[j]; }
if (ok == false) rez = rez + "?";
}
return rez;
}
}
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string a,b;
a = textBox1.Text;
MyzikText IcxodText = new MyzikText(a);
b = IcxodText.Codirovanie();
textBox3.AppendText(b + "\r\n");
}
private void button2_Click(object sender, EventArgs e)
{
string a, b;
a = textBox2.Text;
MyzikText IcxodText1 = new MyzikText(a);
b = IcxodText1.Decodirovanie();
textBox3.AppendText(b + "\r\n");
}
}
}
ItextNoti, ( 0 7) (, 0 7, ).
interface ITextNoti
{
string Codirovanie();
string Decodirovanie();
}
, . . .
11.1.
11.1
.