![]() | ![]() |
|
|
PROGRAMMA ESEGUITO IN TURBOPASCAL 7.0
QUESTO E' UN FACILE PROGRAMMA CHE TI CONSENTE DI ESEGUIRE OPERAZIONI MATEMATICHE.
QUESTO PROGRAMMA E' STATO CREATO PER ESSERE USATO SOLAM 151h74b ENTE AI FINI DIDATTICI.
Program Generale
Uses Crt;
type
Operazioni = object
function somma(a,b : Integer):Integer;
function divisione(a,b : Integer):Integer;
end;
var Oper : Operazioni;
Num1, Num2, Scelta : Integer;
function Operazioni.Somma(a,b : Integer):Integer;
begin
Somma:=a+b;
end;
function Operazioni.Divisione(a,b : Integer):Integer;
begin
Divisione:=a div b;
end;
procedure LetturaDati;
begin
ClrScr;
WriteLn('1) Somma');
WriteLn('2) Divisione');
WriteLn;
Write('Scelta : ');
Readln(Scelta);
end;
procedure ElaborazioneDati;
begin
case Scelta of
1: begin
Write('Primo addendo : ');
ReadLn(Num1);
Write('Secondo addendo : ');
ReadLn(Num2);
WriteLn('Somma = ',Op.Somma(Num1,Num2));
end;
2 : begin
Write('Primo termine : ');
ReadLn(Num1);
Write('Secondo termine : ');
ReadLn(Num2);
if Num2 = 0 then WriteLn('Impossibile') else
WriteLn('Divisione = ',Op.Divisione(Num1,Num2));
end;
end;
if (Scelta<1) and (Scelta>2) then WriteLn('Scegli 1 0 2 !');
end;
begin
LetturaDati;
ElaborazioneDati;
ReadLn;
end
Privacy |
Articolo informazione
Commentare questo articolo:Non sei registratoDevi essere registrato per commentare ISCRIVITI |
Copiare il codice nella pagina web del tuo sito. |
Copyright InfTub.com 2025