Comment faire en sorte que le prog se fasse répéter
Ello,
J'ai réalisé une mini-calculatrice; mon souci est que j'aimerais savoir comment faire en sorte qu'après une opération, elle revienne au début ou à une ligne, que ça ne se termine pas en bref :o
Voila mon code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
program calculatorV3;
uses crt;
var
choice:byte;
a,b,r:longint;
procedure credit;
begin
writeln('Created by Leon');
readln;
end;
procedure addition;
begin
r := a + b;
writeln('The result is : ',r);
end;
procedure substraction;
begin
r := a - b;
writeln('The result is : ',r);
end;
procedure product;
begin
r := a * b;
writeln('The result is : ',r);
end;
procedure division;
begin
if b = 0 then
writeln('Div By 0 Impossible')
else r := a div b;
writeln('The result is : ',r);
end;
procedure menu;
begin
writeln('===Operation Menu===');
writeln('1.Addition');
writeln('2.Substraction');
writeln('3.Product');
writeln('4.Division');
writeln('====================');
writeln;
writeln('Input your 2 numbers a & b');
readln(a);
readln(b);
writeln('Input your choice via it''s number');
readln(choice);
end;
begin
writeln('Welcome to Leon''s Calculator V1.2');
writeln;
menu;
case choice of
1 : addition;
2 : substraction;
3 : product;
4 : division;
5..255 : writeln('Not available');
end;
writeln;
writeln;
writeln;
credit;
end. |