| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 515 人关注过本帖
标题:请各位帮忙看一下偶的Pascal程序
取消只看楼主 加入收藏
Donizyo
Rank: 1
来 自:重庆
等 级:新手上路
帖 子:3
专家分:0
注 册:2009-8-30
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:0 
请各位帮忙看一下偶的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 linear equation;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-30 17:34
快速回复:请各位帮忙看一下偶的Pascal程序
数据加载中...
 
   



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

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