Search
Articles & Documents
Tutorials
Newsletter
CPDB.Net
Friends News
Visits
Webmaster - Infos
|
- Forum - ppCompiler
Topic # 42 |
Problem With Simple Calculator |
30/12/2011 @ 19:09 by lebill
|
Hi!
I had a problem with a simple calculator algorithm, it didn't come up with the right result (this same structure works on Delphi 7). Here is the code:
program sum;
var n1, n2, result: integer;
begin
writeln(''); write('Type in the first number: '); readln(n1); writeln(''); write('Type in the second number: '); readln(n2);
result:= n1 + n2;
writeln('The result is: ',result); readln;
end.
Any feedback would be appreciated, I really enjoy using your program!
-Bill |
|
|
Answer n° 1 -------- 31/12/2011 @ 05:04 by lebill2
visitor |
Oops, sorry, I checked the code again: instead of the first variable n1 I put result... Of course it didn't work!
Even so, I had some trouble with another algorythm using the "for to", I'll review it to see if the problem is also my typing on this one...
Thanks anyway!
-Bill |
|
|
Answer n° 2 -------- 31/12/2011 @ 11:01 by Philippe
visitor |
Anyway, thanks to your post,I found that the the readln procedure does not work properly on some devices, depending on the keyboard. |
|
|
topic active
topic closed
Sticky
New message -
Correct message
Close topic
Make sticky
|