Размещено 5 лет назад по предмету
Информатика
от Джокер13
Суть программы заключается в транслитерации на другие символы. Человек выбирает что ему сделать перевести "privet" в символы или наоборот. Как сделать эту прогу через else. Выбивает ошибки. Т.е. должно сначала выходить 1) "что вы хотите сделать: перевести мое сообщение (нажмите 1) или перевести сообщение от меня(т.е. в обычный алфавит). 2)пользователь выбирает или 1 или 2(если 1 то транслитерация из букв в символы иначе из символов в буквы) 3)Пользователь вводит буквы или цифры и ему выдает переведенный результат. Как сделать программу через else? Она работает и так, но для того, чтобы выбрать первый вариант приходится вводить цифру 1 много раз. С цифрой 2 все в порядке. Помогите пожалуйста, отдаем практически все балы.
Var a1,a4, a5, a6, i :integer; Var a3, a2, b1, b2, b3 : string;
begin Write ('Hello! What do you want from me? It is that what I can: 1)translate message encrypted by me(enter 1) or encrypt message inputted by me(enter 2)'); readln (a2); if a2 = '2' then writeln('enter your message'); readln(a3); for i := 1 to length(a3) do begin if a3[i]='a' then a3[i]:= '*'; if a3[i]='b' then a3[i]:= '+'; if a3[i]='c' then a3[i]:= '-'; if a3[i]='d' then a3[i]:= '='; if a3[i]='e' then a3[i]:= '!'; if a3[i]='f' then a3[i]:= '@'; if a3[i]='g' then a3[i]:= '#'; if a3[i]='h' then a3[i]:= '%'; if a3[i]='i' then a3[i]:= '&'; if a3[i]='g' then a3[i]:= ')'; if a3[i]='k' then a3[i]:= '('; if a3[i]='l' then a3[i]:= '`'; if a3[i]='m' then a3[i]:= '~'; if a3[i]='n' then a3[i]:= '^'; if a3[i]='o' then a3[i]:= ''; if a3[i]='p' then a3[i]:= '/'; if a3[i]='q' then a3[i]:= '}'; if a3[i]='r' then a3[i]:= '{'; if a3[i]='s' then a3[i]:= ']'; if a3[i]='t' then a3[i]:= '['; if a3[i]='u' then a3[i]:= ':'; if a3[i]='v' then a3[i]:= ';'; if a3[i]='w' then a3[i]:= '>'; if a3[i]='y' then a3[i]:= '<'; if a3[i]='z' then a3[i]:= '?'; if a3[i]=' ' then a3[i]:= ' '; if a3[i]='x' then a3[i]:= ','; if a3[i]='.' then a3[i]:= '.'; write(a3[i]); end; if a2 = '1' then writeln('enter my message'); readln(a3); for i := 1 to length(a3) do begin if a3[i]='*' then a3[i]:= 'a'; if a3[i]='+' then a3[i]:= 'b'; if a3[i]='-' then a3[i]:= 'c'; if a3[i]='=' then a3[i]:= 'd'; if a3[i]='!' then a3[i]:= 'e'; if a3[i]='@' then a3[i]:= 'f'; if a3[i]='#' then a3[i]:= 'g'; if a3[i]='%' then a3[i]:= 'h'; if a3[i]='&' then a3[i]:= 'i'; if a3[i]=')' then a3[i]:= 'j'; if a3[i]='(' then a3[i]:= 'k'; if a3[i]='`' then a3[i]:= 'l'; if a3[i]='~' then a3[i]:= 'm'; if a3[i]='^' then a3[i]:= 'n'; if a3[i]='' then a3[i]:= 'j'; if a3[i]='/' then a3[i]:= 'p'; if a3[i]='}' then a3[i]:= 'q'; if a3[i]='{' then a3[i]:= 'r'; if a3[i]=']' then a3[i]:= 's'; if a3[i]='[' then a3[i]:= 't'; if a3[i]=':' then a3[i]:= 'u'; if a3[i]=';' then a3[i]:= 'v'; if a3[i]='>' then a3[i]:= 'w'; if a3[i]='<' then a3[i]:= 'y'; if a3[i]='?' then a3[i]:= 'z'; if a3[i]=' ' then a3[i]:= ' '; if a3[i]=',' then a3[i]:= 'x'; if a3[i]='.' then a3[i]:= '.'; write(a3[i]); end; end.