Var s,s2:string; i:integer;
Begin
readln (s2);
s2:=s2 + ' ';
While i<=length(s) do begin
i:=i+1;
s:='';
While s2[i] <> ' ' do begin
if s='.-' then write('A');
if s='-...' then write('Б');
if s='.--' then write('В');
if s='--.' then write('Г');
if s='-..' then write('Д');
if s='.' then write('Е');
if s='...-' then write('Ж');
if s='--..' then write('З');
if s='..' then write('И');
if s='.---' then write('Й');
if s='-.-' then write('К');
if s='.-..' then write('Л');
if s='--' then write('М');
if s='-' then write('Н');
if s='---' then write('О');
if s='.--.' then write('П');
if s='.-.' then write('Р');
if s='...' then write('С');
if s='-' then write('Т');
if s='..-' then write('У');
if s='..-.' then write(' Ф');
if s='....' then write('Х');
if s='-.-.' then write('Ц');
if s='---.' then write('Ч');
if s='----' then write('Ш');
if s='--.-' then write('Щ');
if s='.--.-' then write('Ъ');
if s='-.--' then write('Ы');
if s='-..-' then write('Ь');
if s='..-.' then write('Э');
if s='..--' then write('Ю');
if s='.-.-' then write('Я');
s:=s+s2[i];
i:=i+1;
fn(s);
End;
End;
End.
Программа для перевода из морзянки в слово. Помогите пожалуйста.
Другие языки программирования и технологии
Сделал программу в паскале, но ее нужно доправить.
Что за три целых, четырнадцать сотых у тебя. Неужели сложно все организовать в массиве
|Dimka| |Gutorov|
В смыcле 3,14? Где?
Эти if s='.-' then write('A');if s='-...' then write('Б');if s='.--' then write('В');if s='--.' then write('Г');if s='-..' then write('Д') ---явно слишком длинно и излишне. Паскаль не знаю, но на Javascript сделал бы куда короче. Для начала так
var morse = ['.-', '-...', '.--', '--.'];
var letters = ['А','Б','В','Г'];
var l = prompt('введите русскую букву');
l = l.toLowerCase();
for (var i = 0; i < letters.length; i++) {
if (letters[i].toLowerCase() == l) {
alert('в морзянке это будет ' + morse[i]);
}
};
var morse = ['.-', '-...', '.--', '--.'];
var letters = ['А','Б','В','Г'];
var l = prompt('введите русскую букву');
l = l.toLowerCase();
for (var i = 0; i < letters.length; i++) {
if (letters[i].toLowerCase() == l) {
alert('в морзянке это будет ' + morse[i]);
}
};
'Н' и 'Т' обозначены одним кодом
Var s,s2:string; i:integer;
procedure fn(s: string);
begin
if s='.-' then write('A');
if s='-...' then write('Б');
if s='.--' then write('В');
if s='--.' then write('Г');
if s='-..' then write('Д');
if s='.' then write('Е');
if s='...-' then write('Ж');
if s='--..' then write('З');
if s='..' then write('И');
if s='.---' then write('Й');
if s='-.-' then write('К');
if s='.-..' then write('Л');
if s='--' then write('М');
if s='-.' then write('Н');
if s='---' then write('О');
if s='.--.' then write('П');
if s='.-.' then write('Р');
if s='...' then write('С');
if s='-' then write('Т');
if s='..-' then write('У');
if s='..-.' then write(' Ф');
if s='....' then write('Х');
if s='-.-.' then write('Ц');
if s='---.' then write('Ч');
if s='----' then write('Ш');
if s='--.-' then write('Щ');
if s='.--.-' then write('Ъ');
if s='-.--' then write('Ы');
if s='-..-' then write('Ь');
if s='..-.' then write('Э');
if s='..--' then write('Ю');
if s='.-.-' then write('Я');
end;
Begin
readln (s2);/// -./---/.../-/.-./.-/-../.-/--/..-/...
s2:=trim(s2)+' ';
repeat
i:=i+1;
s:='';
While s2[i] in ['.','-'] do begin
s:=s+s2[i];
i:=i+1;
End;
for j:integer:=1 to length(s) do
case s[j] of
'.':System.Console.Beep(1200, 200);
'-':System.Console.Beep(1200, 600);
end;
Sleep(900); //пауза между буквами
fn(s);
until i>=length(s2);
End.
Var s,s2:string; i:integer;
procedure fn(s: string);
begin
if s='.-' then write('A');
if s='-...' then write('Б');
if s='.--' then write('В');
if s='--.' then write('Г');
if s='-..' then write('Д');
if s='.' then write('Е');
if s='...-' then write('Ж');
if s='--..' then write('З');
if s='..' then write('И');
if s='.---' then write('Й');
if s='-.-' then write('К');
if s='.-..' then write('Л');
if s='--' then write('М');
if s='-.' then write('Н');
if s='---' then write('О');
if s='.--.' then write('П');
if s='.-.' then write('Р');
if s='...' then write('С');
if s='-' then write('Т');
if s='..-' then write('У');
if s='..-.' then write(' Ф');
if s='....' then write('Х');
if s='-.-.' then write('Ц');
if s='---.' then write('Ч');
if s='----' then write('Ш');
if s='--.-' then write('Щ');
if s='.--.-' then write('Ъ');
if s='-.--' then write('Ы');
if s='-..-' then write('Ь');
if s='..-.' then write('Э');
if s='..--' then write('Ю');
if s='.-.-' then write('Я');
end;
Begin
readln (s2);/// -./---/.../-/.-./.-/-../.-/--/..-/...
s2:=trim(s2)+' ';
repeat
i:=i+1;
s:='';
While s2[i] in ['.','-'] do begin
s:=s+s2[i];
i:=i+1;
End;
for j:integer:=1 to length(s) do
case s[j] of
'.':System.Console.Beep(1200, 200);
'-':System.Console.Beep(1200, 600);
end;
Sleep(900); //пауза между буквами
fn(s);
until i>=length(s2);
End.
Похожие вопросы
- помогите плиз написать программу на паскале...тема массивы...нужно использовать поиск деления пополам!!!нужно срочно!
- Помогите сделать программу на паскале
- Нужно написать программы в Паскале! Массивы! Срочно! Помогите!
- Нужно написать программу на паскале
- Люди как сделать легкую программу на паскале, и вобще какой язык программирования лучше для новичка
- Сделайте пожалуйста программу на Паскале. Заранее спасибо!!!!
- Программа на паскале! Помогите(бесплатно)
- Написать программу в Паскале для построения графика функций. К программе желательно составить алгоритм.
- Программа в Паскале
- Помогите составить программу на паскале!