Delphi控制台输⼊输出程序program Project2;
{$APPTYPE CONSOLE}
uses
SysUtils;
//定义⼀个结构类型
type Tpeople = record
Name :string;
Age:Integer;
Sex:string;
end;
procedure init();
begin
Writeln('┏━━━━━┳━━━━━┳━━━━━┓');
delphi appWriteln('┣━━━━━┻━━━━━┻━━━━━┫');
Writeln('┃ Delphi控制台输⼊输出测试程序┃');
Writeln('┃ (a:)运⾏DEMO1 ┃');
Writeln('┃ (b:)运⾏DEMO2 ┃');
Writeln('┃ (q:)退出程序┃');
Writeln('┣━━━━━┳━━━━━┳━━━━━┫');
Writeln('┗━━━━━┻━━━━━┻━━━━━┛');
end;
procedure demo1();
var
people:Tpeople;
begin
with people do
begin
Name := '⼩明';
Age := 25;
Sex := '男';
end;
Writeln('Name:',people.Name);
Writeln('Age:',people.Age);
Writeln('Sex:',people.Sex);
//Readln;
end;
procedure demo2();
var
o:string;
begin
Writeln('这是DEMO2');
end;
procedure testConsole();
var s:string;
begin
write('请输⼊命令: ');
Readln(s);
while true do
begin
if s = EmptyStr then
begin
write('请输⼊命令: ');
Readln(s);
end
else
else
begin
s := LowerCase(s);
case s[1] of
'a':
begin
demo1();
end;
'b':
begin
demo2();
end;
'q':
begin
break;
end;
else
writeln('输⼊的命令不存在!');
end;
write('请输⼊命令: ');
Readln(s);
end;
end;
end;
begin
init();
testConsole();
end.
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论