Esempio_turbopascal.

Materie:Appunti
Categoria:Informatica
Download:19
Data:02.02.2001
Numero di pagine:1
Formato di file:.doc (Microsoft Word)
Download   Anteprima
esempio-turbopascal_1.zip (Dimensione: 3.02 Kb)
trucheck.it_esempio_turbopascal.doc     21.5 Kb
readme.txt     59 Bytes


Testo

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 SOLAMENTE 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 (Scelta2) then WriteLn('Scegli 1 0 2 !');

end;

begin

LetturaDati;

ElaborazioneDati;

ReadLn;

end

Esempio