Recherche
Articles & Documents
Tutoriaux
Lettre d'information
CPDB.Net
Nouvelles des Amis
Visites
Webmaster - Infos
|
- Forum - ppCompiler
Sujet n° 42 |
Problem With Simple Calculator |
le 30/12/2011 @ 19:09 par 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 |
|
|
Réponse n° 1 -------- le 31/12/2011 @ 05:04 par lebill2
visiteur |
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 |
|
|
Réponse n° 2 -------- le 31/12/2011 @ 11:01 par Philippe
visiteur |
Anyway, thanks to your post,I found that the the readln procedure does not work properly on some devices, depending on the keyboard. |
|
|
sujet actif
sujet clos
Important!
Nouveau message -
Rectifier message
Clôturer sujet
Remonter
|