标题:请各位帮忙看一下偶的Pascal程序
只看楼主
Donizyo
Rank: 1
来 自:重庆
等 级:新手上路
帖 子:3
专家分:0
注 册:2009-8-30
结帖率:100%
 问题点数:0 回复次数:2 
请各位帮忙看一下偶的Pascal程序
实在找不到Pascal专区,就到这里来看谁能够帮忙修改一下(最好是旁批)~~
Program Equation(Input,Output);
Var                        
A,B,C,X,Dr,S:Real; {Y=0}
Q:Char;
{Selection Part};
Writeln('Please input 1 or 2,if you select 1,I can calculate linearequation;and if you select 2,I can calculate quadratic equation.')
Readln(S);
{Linear equation part};
If (X=1) Then Begin
               Writeln('Please input A,B');
               Readln(A,B);
               If (A<>0) then X:=(-B)/A;
               Writeln('The result is, X=',X);
               Else Writeln('No root!');
{Quadratic equation part};
Else if (X=2) then Begin
                    Writeln('Please input A,B,C');
                    Readln(A,B,C);Dr:=B*B-4*A*C;{A*X*X+B*X+C=0};
                    If (A<>0) then begin
                                    If (Dr>0) then writeln('X1=',X:=(-B+Sqrt(Dr))/2*A);
                                                   writeln('X2=',X:=(-B-Sqrt(Dr))/2*A);
                                    If (Dr=0) then writeln('X1=X2=',X:=(-B)/2*A);
                                    If (Dr<0) then writeln('No root!');
                    Else writeln(No root!);
Writeln('Well done!');
Write('Please input Quit so that you can quit this program.');
Readln(Q);
If (Q=Quit) Then writeln('Thank you for using');writeln('*****************************');
End.
搜索更多相关主题的帖子: Pascal 
2009-08-31 14:14
Donizyo
Rank: 1
来 自:重庆
等 级:新手上路
帖 子:3
专家分:0
注 册:2009-8-30
得分:0 
hhscbasbcadcbadcadcdcccaccsadacaadcadcaca
2009-09-05 16:25
qiye9801
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2011-7-17
得分:0 
要问的是什么问题,wa还是ce?
2011-07-17 09:16



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-284271-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.262691 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved