Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Problem, can anyone help. Posted by odan16 on 12 Mar 2003 at 9:27 AM
I have written a program to calculate an electricity bill as part of my college assignment and I've just found a problem that I am unable to solve.

The calculations I have done in the program are correct, but when I display the results of calculations involving high numbers (over 1000), they appear incorrectly and I do not understand why. Can anyone tell me how to solve this?
Report
Re: Problem, can anyone help. Posted by sweeney on 12 Mar 2003 at 9:50 AM
: I have written a program to calculate an electricity bill as part of my college assignment and I've just found a problem that I am unable to solve.
:
: The calculations I have done in the program are correct, but when I display the results of calculations involving high numbers (over 1000), they appear incorrectly and I do not understand why. Can anyone tell me how to solve this?
:
are you using integer? try using longint; or word; this will give you bigger number abilaty! if not then post some of your code so that we can see where u are going wrong!

sweeney
Report
Re: Problem, can anyone help. Posted by odan16 on 12 Mar 2003 at 10:04 AM
Well the output I want is in real format. I've tried using double but it doesn't work either. The calculations I have done are correct and work fine on numbers under 1000.
Report
Re: Problem, can anyone help. Posted by sweeney on 12 Mar 2003 at 10:18 AM
: Well the output I want is in real format. I've tried using double but it doesn't work either. The calculations I have done are correct and work fine on numbers under 1000.
:
nope its ok right do you know decamal places you need to do it in this case! ok give me the output line and I will fix it!
Report
Re: Problem, can anyone help. Posted by sweeney on 12 Mar 2003 at 10:32 AM
: : Well the output I want is in real format. I've tried using double but it doesn't work either. The calculations I have done are correct and work fine on numbers under 1000.
: :
: nope its ok right do you know decamal places you need to do it in this case! ok give me the output line and I will fix it!
:
see real is decamal numbers! so here is an example

program example;
uses crt;

begin
write(' Enter the price of the product: ');
readln(price);
discount := price / 10;
writeln('The discount is as follows',discount1:2:); {this is where the decamal is read! :1:2: says is the 2 decamle places after the 1st you can chage that to any number you wish!}
readln; untill enter is presed;
end.


Report
Re: Problem, can anyone help. Posted by odan16 on 12 Mar 2003 at 12:15 PM
Lol omg! I can't believe it! I spent ages looking for the problem and it turns out I just mislabelled a variable. Sorry bout that.
Report
Re: Problem, can anyone help. Posted by sweeney on 12 Mar 2003 at 1:27 PM
: Lol omg! I can't believe it! I spent ages looking for the problem and it turns out I just mislabelled a variable. Sorry bout that.
:
lmao duhh lol joking hey glad to help anyways! lol



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.