readex.txt

来自「一个编译器源代码。用法看里面的“使用说明”」· 文本 代码 · 共 44 行

TXT
44
字号
Program(ReadEx,Dos.MZ);
  Var(Select,Byte);
  Var(Char,Byte);

  Const(Menu1,' [1] upper- to lowercase'+CrLf);
  Const(Menu2,' [2] lower- to uppercase'+CrLf);
  Const(Choice,'What'+Quote.Single+'s your choice...');
  Const(Command,CrLf+CrLf+'Type a key on your keyboard (in proper case): ');
Begin
  Screen.Clear;
  Write('Do you want to convert:'+CrLf+Menu1+Menu2+Choice);
  Select = Read() - $30;
  If Select = 1 Goto UpLow;
  If Select = 2 Goto LowUp;
  Jump(Wrong);

  UpLow:
    Write(Command);
    Char = Read() + $20;
    IfNot Char in ['a'..'z'] Goto NotUpperCase;
    Write(CrLf+Char+' is the lowercase of the character you typed.');
    Jump(Exit);

  LowUp:
    Write(Command);
    Char = Read() - $20;
    IfNot Char in ['A'..'Z'] Goto NotLowerCase;
    Write(CrLf+Char+' is the uppercase of the character you typed.');
    Jump(Exit);

  NotUpperCase:
    Write(CrLf+'The character you typed was not a letter in uppercase!');
    Jump(UpLow);

  NotLowerCase:
    Write(CrLf+'The character you typed was not a letter in lowercase!');
    Jump(LowUp);

  Wrong:
    Write(CrLf+CrLf+'Problems to read? You have to choose 1 or 2!');

  Exit:
    Wait;
End;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?