在free pascal编写一个程序,输出一列图形(字母金字塔)
aababcabcd··abc……xyz设计如上顶上的a不知为什么变了,a应该在ab上,这是网页上的打印错了...
a
a b
a b c
a b c d
· ·
a b c……x y z
设计如上
顶上的a不知为什么变了,a应该在ab上,这是网页上的打印错了 展开
a b
a b c
a b c d
· ·
a b c……x y z
设计如上
顶上的a不知为什么变了,a应该在ab上,这是网页上的打印错了 展开
3个回答
展开全部
program testcase;
var n,x,y:byte;
begin
repeat
begin
write('Input N -> [1,26]:');
readln(n);
end;
until (n>=1) and (n<=26);
for x:=1 to n do
begin
{画空格}
for y:=1 to n-x do
write(' ');
for y:=1 to x do
begin
write(chr(96+y),' ');
end;
writeln;
end;
writeln('Press ENTER to end...');
readln();
end.
=======
输出
Input N -> [1,26]:26
a
a b
a b c
a b c d
a b c d e
a b c d e f
a b c d e f g
a b c d e f g h
a b c d e f g h i
a b c d e f g h i j
a b c d e f g h i j k
a b c d e f g h i j k l
a b c d e f g h i j k l m
a b c d e f g h i j k l m n
a b c d e f g h i j k l m n o
a b c d e f g h i j k l m n o p
a b c d e f g h i j k l m n o p q
a b c d e f g h i j k l m n o p q r
a b c d e f g h i j k l m n o p q r s
a b c d e f g h i j k l m n o p q r s t
a b c d e f g h i j k l m n o p q r s t u
a b c d e f g h i j k l m n o p q r s t u v
a b c d e f g h i j k l m n o p q r s t u v w
a b c d e f g h i j k l m n o p q r s t u v w x
a b c d e f g h i j k l m n o p q r s t u v w x y
a b c d e f g h i j k l m n o p q r s t u v w x y z
Press ENTER to end...
============
这种题要自己做才有意思,别人做了,你还是不会呵呵
var n,x,y:byte;
begin
repeat
begin
write('Input N -> [1,26]:');
readln(n);
end;
until (n>=1) and (n<=26);
for x:=1 to n do
begin
{画空格}
for y:=1 to n-x do
write(' ');
for y:=1 to x do
begin
write(chr(96+y),' ');
end;
writeln;
end;
writeln('Press ENTER to end...');
readln();
end.
=======
输出
Input N -> [1,26]:26
a
a b
a b c
a b c d
a b c d e
a b c d e f
a b c d e f g
a b c d e f g h
a b c d e f g h i
a b c d e f g h i j
a b c d e f g h i j k
a b c d e f g h i j k l
a b c d e f g h i j k l m
a b c d e f g h i j k l m n
a b c d e f g h i j k l m n o
a b c d e f g h i j k l m n o p
a b c d e f g h i j k l m n o p q
a b c d e f g h i j k l m n o p q r
a b c d e f g h i j k l m n o p q r s
a b c d e f g h i j k l m n o p q r s t
a b c d e f g h i j k l m n o p q r s t u
a b c d e f g h i j k l m n o p q r s t u v
a b c d e f g h i j k l m n o p q r s t u v w
a b c d e f g h i j k l m n o p q r s t u v w x
a b c d e f g h i j k l m n o p q r s t u v w x y
a b c d e f g h i j k l m n o p q r s t u v w x y z
Press ENTER to end...
============
这种题要自己做才有意思,别人做了,你还是不会呵呵
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询