Кодирование открытого текста шифрограммы по правилам азбуки Морзе
Категория: C/C++
2012-02-13 16:51:50
code: #cpp
class Word { private string s; private string[,] morz_arr = new string[52, 3] { {"а","a",".-"}, {"б","b","-..."}, {"в","w",".--"}, {"г","g","--."}, {"д","d","-.."}, {"е","e","."}, {"ж","v","...-"}, {"з","z","--.."}, {"и","i",".."}, {"й","j",".---"}, {"к","k","-.-"}, {"л","l",".-.."}, {"м","m","--"}, {"н","n","-."}, {"о","o","---"}, {"п","p",".--."}, {"р","r",".-."}, {"с","s","..."}, {"т","t","-"}, {"у","u","..-"}, {"ф","f","..-."}, {"х","h","...."}, {"ц","c","-.-."}, {"ч","none","---."}, {"ш","none","----"}, {"щ","q","--.-"}, {"ъ","none","--.--"}, {"ы","y","-.--"}, {"ь","x","-..-"}, {"э","none","..-.."}, {"ю","none","..--"}, {"я","none",".-.-"}, {"1","none",".----"}, {"2","none","..---"}, {"3","none","...--"}, {"4","none","....-"}, {"5","none","....."}, {"6","none","-...."}, {"7","none","--..."}, {"8","none","---.."}, {"9","none","----."}, {"0","none","-----"}, {".","none","······"}, {":","none","−−−···"}, {";","none","−·−·−·"}, {"(",")","−·−−·−"}, {"_","none","·−−−−·"}, {"\"","none","·−··−·"}, {"-","none","−····−"}, {"/","none","−··−·"}, {"?","none","··−−··"}, {"!","none","−−··−−"} }; public Word(string text) { s = text; } public string ConverToMorz() { string ret = ""; for ( int i = 0; i < s.Length; i++ ) { for ( int j = 0; j < 52; j++ ) { for ( int l = 0; l < 3; l++ ) { if ( s[i].ToString() == morz_arr[j, l] ) { ret += morz_arr[j, 2]; } } } } return ret; } }
автор: Дмитрий3241
Поделиться: