Latest versions
...
Menu  Language: fr
Search




Articles & Documents

Close Tutorials

Preferences

Connect again
---

Your name (or pseudo) :

Your secret code (associated with your pseudo)


 Count of members 409 members


Connected :

(nobody)
CPDB.Net

Friends News
Google Ads
Newsletter
To receive news about this website, consider subscribing to our Newsletter.
Subscribe
Unsubscribe
23 Subscribers
Webmaster - Infos
Visits

   visitors

   visitors online

Pagerank
forum.gifForum - ppCompiler [EN] - Topic #42

Forum - Forum
ppCompiler [EN] - ppCompiler [EN]


active  Topic # 42  Problem With Simple Calculator

30/12/2011 @ 19:09
by lebill

lebill

visitor

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
  Post an answer  Top
Answer n° 1
--------
31/12/2011 @ 05:04
by lebill2

lebill2


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
Write to lebill2   Post an answer  Top
Answer n° 2
--------
31/12/2011 @ 11:01
by Philippe

Anonymous


Anyway, thanks to your post,I found that the the readln procedure does not work properly on some devices, depending on the keyboard.
Write to Philippe   Post an answer  Top
active topic active   closed topic closed   Sticky Sticky   New New message   -   Correct Correct message   Close Close topic   Make sticky Make sticky
[]
Forum Topic  Forum 




^ Top ^