pascal有错误看看哪里错了?program paixu(input,output);vara,b,c,d :inte
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/07/18 17:48:57
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.
看看哪里错了?
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.
你这个应该是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
楼主应该是初学者吧,希望你再接再励,在编程的领域获得成功!
再问: 编写程序:a,b,c分别等于1、12、123,把它们按向左对齐、向右对齐的方式打印出来。 program duiqi(input,output); const a=1; b=12; c=123; begin readln(a,b,c); writeln(a); writeln(b); writeln(c); writeln(a:3); writeln(b:3); writeln(c:3); end. 呵呵,初学者
再答: a,b,c已经被定义为常量了,就不能再对它们进行更改了(readln(a,b,c);) 要么把a,b,c设定为变量,要么删了readln(a,b,c).
我先说一句,你的缩进做的不是很好,希望你以后改正.
第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
楼主应该是初学者吧,希望你再接再励,在编程的领域获得成功!
再问: 编写程序:a,b,c分别等于1、12、123,把它们按向左对齐、向右对齐的方式打印出来。 program duiqi(input,output); const a=1; b=12; c=123; begin readln(a,b,c); writeln(a); writeln(b); writeln(c); writeln(a:3); writeln(b:3); writeln(c:3); end. 呵呵,初学者
再答: a,b,c已经被定义为常量了,就不能再对它们进行更改了(readln(a,b,c);) 要么把a,b,c设定为变量,要么删了readln(a,b,c).
Input & Output
一道C语言题:A+B for Input-Output Practice (III)
c程序acm题目A+B for Input-Output Practice (VII) Time Limit : 200
1. Write a program to copy its input to its output, replacin
output += input[input.Length -
input-processing-output是什么意思
lingo8.0错误11 Invalid input.A syntax error has occurred 哪里有错误
答案上说B、C、D是错误的,错在哪里?
a+b用C怎么写?Sample Input 1 5 Sample Output 6补充用GCC编译:gcc 1.c -o
错误选项错在了哪里?(包括最上面的c,d两个选项)
More input brings more output
multiple input-multiple output是什么意思