pascal初学者求助编写程序!!!!!!!!!
1.输入a,b,c三个不同的数,将它们按由小到大的顺序输出。2.编程模拟剪刀、石头、布游戏:用S表示剪刀,用R表示石头,用P表示布。规则是:剪刀剪布,石头砸剪刀,布包石头...
1.输入a,b,c三个不同的数,将它们按由小到大的顺序输出。
2.编程模拟剪刀、石头、布游戏:用S表示剪刀,用R表示石头,用P表示布。规则是:剪刀剪布,石头砸剪刀,布包石头。游戏者分别把自己的选择输入,计算机给出结果。3.输入两个数a,b,输出较大数的平方值。
4.从键盘读入一个数,判断它的正负。是正数,则输出"+",是负数,则输出"-"。 展开
2.编程模拟剪刀、石头、布游戏:用S表示剪刀,用R表示石头,用P表示布。规则是:剪刀剪布,石头砸剪刀,布包石头。游戏者分别把自己的选择输入,计算机给出结果。3.输入两个数a,b,输出较大数的平方值。
4.从键盘读入一个数,判断它的正负。是正数,则输出"+",是负数,则输出"-"。 展开
3个回答
展开全部
1.var a,b,c:integer;
procedure jiaohuan(var a,b:integer)
begin
t:=a;
a:=b;
b:=t;
end;
begin
readln(a,b,c);
if a>b then jiaohuan(a,b);
if b>c then jiaohuan(b,c);
if a>c then jiaohuan(a,c);
writeln(a,b,c);
end.
2.var r1:char;r2,d:byte;
begin
repeat
readln(r1);
until r1 in[s,r,p];
case r1 of
s:r2:=1;
r:r2:=2;
p:r2:=3;
end;
d:=trunc(random(3))+1;
case (d-r2) of
1:writeln('shu');
2:writeln('ying');
0:writeln('ping');
-1:writeln('ying');
-2:writeln('shu');
end;
end.
3.var a,b:integer;
begin
readln(a,b);
if a>b then writeln(a*a) else writeln(b*b);
end.
4.var a:integer;
begin
readln(a);
if a>0 then writeln('+');
if a<0 then writeln('-');
end.
procedure jiaohuan(var a,b:integer)
begin
t:=a;
a:=b;
b:=t;
end;
begin
readln(a,b,c);
if a>b then jiaohuan(a,b);
if b>c then jiaohuan(b,c);
if a>c then jiaohuan(a,c);
writeln(a,b,c);
end.
2.var r1:char;r2,d:byte;
begin
repeat
readln(r1);
until r1 in[s,r,p];
case r1 of
s:r2:=1;
r:r2:=2;
p:r2:=3;
end;
d:=trunc(random(3))+1;
case (d-r2) of
1:writeln('shu');
2:writeln('ying');
0:writeln('ping');
-1:writeln('ying');
-2:writeln('shu');
end;
end.
3.var a,b:integer;
begin
readln(a,b);
if a>b then writeln(a*a) else writeln(b*b);
end.
4.var a:integer;
begin
readln(a);
if a>0 then writeln('+');
if a<0 then writeln('-');
end.
展开全部
1.program NO1;
var a,b,c,t:integer;
begin
if a>b then begin t:=a;a:=b;b:=t;end;
if a>c then begin t:=a;a:=c;c:=t;end;
if b>c then begin t:=b;b:=c;c:=t;end;
writeln(a,' ',b,' ',c);
end.
2.题目叙述模糊,看不懂.
3.program NO3;
var a,b:integer;
begin
readln(a,b);
if a>b then writeln(a*a) else writeln(b*b);
end.
4.program NO4;
var a:integer;
begin
readln(a);
if a>0 then writeln('+');
if a<0 then writeln('-');
end.
var a,b,c,t:integer;
begin
if a>b then begin t:=a;a:=b;b:=t;end;
if a>c then begin t:=a;a:=c;c:=t;end;
if b>c then begin t:=b;b:=c;c:=t;end;
writeln(a,' ',b,' ',c);
end.
2.题目叙述模糊,看不懂.
3.program NO3;
var a,b:integer;
begin
readln(a,b);
if a>b then writeln(a*a) else writeln(b*b);
end.
4.program NO4;
var a:integer;
begin
readln(a);
if a>0 then writeln('+');
if a<0 then writeln('-');
end.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
var a:array[1..1000] of integer;
b:integer;
begin
for i:=1 to 3 do
readln(a[i]);
if a[i]<a[i+1] then
begin
b:=a[i];
a[i]:=a[i+1];
a[i+1]:=b;
end;
for i:=1 to 3 do
write(a[i]);
end.
b:integer;
begin
for i:=1 to 3 do
readln(a[i]);
if a[i]<a[i+1] then
begin
b:=a[i];
a[i]:=a[i+1];
a[i+1]:=b;
end;
for i:=1 to 3 do
write(a[i]);
end.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询