pascal有错误看看哪里错了?program paixu(input,output);vara,b,c,d :integer;beginreadln(a,b,c);if a>b then begind:=a;if c>d then write(c );write(d );wrire(b);elsewrite(d );write(c );write(b);endelse begind:=b;if c>d then write(c );write(d );wri

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/26 02:54:32
pascal有错误看看哪里错了?programpaixu(input,output);vara,b,c,d:integer;beginreadln(a,b,c);ifa>bthenbegind:=a;

pascal有错误看看哪里错了?program paixu(input,output);vara,b,c,d :integer;beginreadln(a,b,c);if a>b then begind:=a;if c>d then write(c );write(d );wrire(b);elsewrite(d );write(c );write(b);endelse begind:=b;if c>d then write(c );write(d );wri
pascal有错误
看看哪里错了?
program paixu(input,output);
var
a,b,c,d :integer;
begin
readln(a,b,c);
if a>b then
begin
d:=a;
if c>d then
write(c );
write(d );
wrire(b);
else
write(d );
write(c );
write(b);
end
else
begin
d:=b;
if c>d then
write(c );
write(d );
write(a);
else
write(d );
write(c );
write(a);
end;
end.

pascal有错误看看哪里错了?program paixu(input,output);vara,b,c,d :integer;beginreadln(a,b,c);if a>b then begind:=a;if c>d then write(c );write(d );wrire(b);elsewrite(d );write(c );write(b);endelse begind:=b;if c>d then write(c );write(d );wri
你这个应该是3个数的排序吧,从大到小.
我先说一句,你的缩进做的不是很好,希望你以后改正.
第13行,write写错了,不应该是wrire.
很多地方begin和end忘记加了
帮你把分开的write合并了一下
integer建议你换成longint,现在的电脑配置都比以前好很多.
如果要一行一行输出,把我给你添的去掉,大括号去掉,write改成writeln.
下面是改过的程序,大括号是有错的地方.
var a,b,c,d:longint; {a,b,c,d:integer;}
begin
readln(a,b,c);
if a>b
then begin
d:=a;
if c>d
then begin {缺begin}
{write(c);
write(d);
write(b);原wrire(b); 拼写错误 以上三句以合并 }
writeln(c,' ',d,' ',b);
end {缺end}
else begin
{write(d);
write(c);
write(b); 以上三句以合并}
writeln(d,' ',c,' ',b);
end
end {缺end}
else
begin
d:=b;
if c>d
then begin {缺begin}
{ write(c);
write(d);
write(a); 以上三句以合并}
writeln(c,' ',d,' ',a);
end {缺end}
else begin {缺begin}
{write(d);
write(c);
write(a); 以上三句以合并}
writeln(d,' ',c,' ',a);
end; {缺end}
end;
end.
附:选择排序(从小到大)
var a:array[1..100] of longint;
temp,i,j:longint;
begin
readln(n);
for i:=1 to n do
read(a[i]);
for i:=1 to n do
for j:=i+1 to n do
if a[i]>a[j]
then begin
temp:=a[i];
a[i]:=a[j];
a[j]:=temp;
end;
for i:=1 to n-1 do
write(a[i],' ');
writeln(a[n]);
end.
样例输入
5
1 3 2 4 5
样例输出
1 2 3 4 5
楼主应该是初学者吧,希望你再接再励,在编程的领域获得成功!