Forum - Pascal
- Problemi con if
()
Newbie
Messaggi:
Iscritto:
Codice sorgente - presumibilmente Delphi
program menu;
uses crt;
var
tasto: char ;
flag: boolean ;
cont: integer ;
begin
cont: = 0 ;
flag: = false ;
repeat
clrscr;
textbackground( white) ;
textcolor( black) ;
gotoxy( 1, 1) ; writeln ( 'Cosa vuoi fare?' ) ;
gotoxy( 30, 15) ; writeln ( 'Ascoltare musica' ) ;
gotoxy( 30, 17) ; writeln ( 'Registrare musica' ) ;
gotoxy( 30, 19) ; writeln ( 'Uscire' ) ;
repeat
tasto: = readkey;
until ( tasto= #80 ) or ( tasto= #72 ) ;
if ( tasto= #80 ) then cont: = cont+ 1 ;
if ( tasto= #72 ) then cont: = cont- 1 ;
if cont= 4 then cont: = 1 ;
if cont=- 1 then cont: = 3 ;
case cont of
1: begin
clrscr;
gotoxy( 1, 1) ; writeln ( 'Cosa vuoi fare?' ) ;
textcolor( red) ;
gotoxy( 30, 15) ; writeln ( 'Ascoltare musica' ) ;
gotoxy( 30, 17) ; writeln ( 'Registrare musica' ) ;
gotoxy( 30, 19) ; writeln ( 'Uscire' ) ;
end ;
2: begin
clrscr;
gotoxy( 1, 1) ; writeln ( 'Cosa vuoi fare?' ) ;
gotoxy( 30, 15) ; writeln ( 'Ascoltare musica' ) ;
textcolor( red) ;
gotoxy( 30, 17) ; writeln ( 'Registrare musica' ) ;
textcolor( black) ;
gotoxy( 30, 19) ; writeln ( 'Uscire' ) ;
end ;
3: begin
clrscr;
gotoxy( 1, 1) ; writeln ( 'Cosa vuoi fare?' ) ;
gotoxy( 30, 15) ; writeln ( 'Ascoltare musica' ) ;
gotoxy( 30, 17) ; writeln ( 'Registrare musica' ) ;
textcolor( red) ;
gotoxy( 30, 19) ; writeln ( 'Uscire' ) ;
flag: = true ;
end ;
end ;
until flag;
end .
avevo già postato..ma adesso ho modificato perchè ho risolto da solo..qualcuno mi sa spiegare perchè si vede il colore solo con l'ultima opzione?!
Ultima modifica effettuata da il 07/03/2010 alle 0:59
Poggi Marco (Member )
Guru
Messaggi: 969
Iscritto: 05/01/2010
Ciao.
Ho letto il programma, e mon ho capito bene cosa deve fare.
Comuncue l' errore è dovuto al fatto imposti count in maniera errata.
Puoi usare direttamente tasto nei case, ed eventualmente specificare il tasto da premere nei menu'.
Un altro errore e quello di riscrivere il menù all' inizio del ciclo repeat.
In questo modo cancelli quello che scrivi nei case.
Come mai con P aumenti count, mentre con H lo diminuisci?
Ultima modifica effettuata da Poggi Marco il 07/03/2010 alle 12:00
XBarboX (Member )
Guru
Messaggi: 945
Iscritto: 31/12/2008
Postato originariamente da Poggi Marco :
Comuncue
Ultima modifica effettuata da XBarboX il 07/03/2010 alle 15:20
Poggi Marco (Member )
Guru
Messaggi: 969
Iscritto: 05/01/2010
Postato originariamente da XBarboX :
Postato originariamente da Poggi Marco :
Comuncue
Opss...
Chiedo scusa!
()
Newbie
Messaggi:
Iscritto:
Sono tornato proprio ora da una giornati in un agriturismo e ho terminato il programma
purtroppo sul mio pc la funzione sound non va se qualcuno mi fa la cortesia di compilarlo e farmi sapere se funge o meno gliene sarei grato
Codice sorgente - presumibilmente Delphi
program riproduttore_multimediale;
uses crt;
var
tasto: char ;
flag: boolean ;
cont: integer ;
{Procedura per riprodurre il suono}
procedure riproduci_suono( input: integer ) ;
var
intensita, durata: integer ;
begin
intensita: = input mod 1000 ;
durata: = input- intensita;
sound( intensita) ;
delay( durata) ;
nosound;
end ;
{Procedura per registrare il suono}
procedure registra;
var
lunghezza, frequenza, codificato: integer ;
percorso: string [ 30] ;
nota: string [ 3] ;
uscita: boolean ;
file_output: textfile ;
tasto: char ;
begin
CLRSCR;
uscita: = false ;
write ( 'Percorso in cui salvare il file audio : ' ) ; readln ( percorso) ;
assign( file_output, percorso) ;
rewrite ( file_output) ;
repeat
repeat
clrscr;
textcolor( black) ;
gotoxy( 1, 1) ;
writeln ( 'Premi ESC per uscire (uscirà dopo aver digitato la nota da salvare)' ) ;
gotoxy( 20, 6) ;
write ( 'Nota (DO/RE/MI/FA/SOL/LA/SI) : ' ) ;
tasto: = readkey;
if tasto= #27 then uscita: = true ;
textcolor( red) ;
readln ( nota) ;
until ( nota= 'DO' ) or ( nota= 'RE' ) or ( nota= 'MI' ) or ( nota= 'FA' ) or ( nota= 'SOL' ) or ( nota= 'LA' ) or ( nota= 'SI' ) or uscita;
textcolor( black) ;
write ( 'Durata (in secondi) : ' ) ; readln ( lunghezza) ;
if nota= 'DO' then frequenza: = 262
else if nota= 'RE' then frequenza: = 294
else if nota= 'MI' then frequenza: = 330
else if nota= 'FA' then frequenza: = 349
else if nota= 'SOL' then frequenza: = 392
else if nota= 'LA' then frequenza: = 440
else if nota= 'SI' then frequenza: = 494 ;
codificato: = frequenza+ lunghezza* 1000 ;
append ( file_output) ;
write ( file_output, codificato) ;
write ( file_output, ' ' ) ;
close ( file_output) ;
until uscita;
end ;
{procedura per la riproduzione}
procedure riproduzione;
type contenitore= array [ 1.. 255] of integer ;
var
i, b: integer ;
letto: contenitore;
percorso: string [ 30] ;
file_input: textfile ;
begin
write ( 'Percorso file da riprodurre : ' ) ; readln ( percorso) ;
assign( file_input, percorso) ;
reset ( file_input) ;
i: = 1 ;
while not eof ( file_input) do
begin
read ( file_input, letto[ i] ) ;
i: = i+ 1 ;
end ;
b: = i;
i: = 1 ;
for i: = 1 to b do
begin
riproduci_suono( letto[ i] ) ;
end ;
end ;
{Programma}
begin
cont: = 0 ;
flag: = false ;
clrscr;
textbackground( white) ;
textcolor( white) ;
gotoxy( 1, 1) ; writeln ( 'Cosa vuoi fare?' ) ;
gotoxy( 30, 15) ; writeln ( 'Ascoltare musica' ) ;
gotoxy( 30, 17) ; writeln ( 'Registrare musica' ) ;
gotoxy( 30, 19) ; writeln ( 'Uscire' ) ;
repeat
repeat
tasto: = readkey;
until ( tasto= #80 ) or ( tasto= #72 ) ;
if ( tasto= #80 ) then begin tasto: = ' ' ; cont: = cont+ 1 end ;
if ( tasto= #72 ) then begin tasto: = ' ' ; cont: = cont- 1 end ;
if cont= 4 then cont: = 1 ;
if cont=- 1 then cont: = 3 ;
case cont of
1: begin
clrscr;
textcolor( white) ;
gotoxy( 1, 1) ; writeln ( 'Cosa vuoi fare?' ) ;
textcolor( red) ;
gotoxy( 30, 15) ; writeln ( 'Ascoltare musica' ) ;
textcolor( white) ;
gotoxy( 30, 17) ; writeln ( 'Registrare musica' ) ;
gotoxy( 30, 19) ; writeln ( 'Uscire' ) ;
repeat
begin
tasto: = readkey;
if tasto= #13 then riproduzione;
end ;
until ( tasto= #13 ) or ( tasto= #80 ) or ( tasto= #72 ) ;
end ;
2: begin
clrscr;
textcolor( white) ;
gotoxy( 1, 1) ; writeln ( 'Cosa vuoi fare?' ) ;
gotoxy( 30, 15) ; writeln ( 'Ascoltare musica' ) ;
textcolor( red) ;
gotoxy( 30, 17) ; writeln ( 'Registrare musica' ) ;
textcolor( white) ;
gotoxy( 30, 19) ; writeln ( 'Uscire' ) ;
repeat
begin
tasto: = readkey;
if tasto= #13 then registra;
end ;
until ( tasto= #13 ) or ( tasto= #80 ) or ( tasto= #72 ) or ( tasto= #27 ) ;
end ;
3: begin
clrscr;
gotoxy( 1, 1) ; writeln ( 'Cosa vuoi fare?' ) ;
gotoxy( 30, 15) ; writeln ( 'Ascoltare musica' ) ;
gotoxy( 30, 17) ; writeln ( 'Registrare musica' ) ;
textcolor( red) ;
gotoxy( 30, 19) ; writeln ( 'Uscire' ) ;
repeat
begin
tasto: = readkey;
if tasto= #13 then
begin
writeln ( 'Bye bye :D' ) ; delay( 3000) ;
flag: = true
end ;
end ;
until ( tasto= #13 ) or ( tasto= #80 ) or ( tasto= #72 ) ;
end ;
end ;
until flag;
end .
errori/consigli/migliorie sono ben accetti (sono un principiante ancora:rofl
Poggi Marco (Member )
Guru
Messaggi: 969
Iscritto: 05/01/2010
Ho letto il programma, e la scelta del menu è ancore molto macchinosa.
Potresti accedere alle varie funzioni del programma, confrontando semplicemente la veriabile tasto.
La funzione di registrazione, è alquanto confusa.
La chiusura del file, avviene all' interno del ciclo repeat. In questo modo verra salvata solo la prima nota. Il mio consiglio è quello di salvare il valore "codificato" e "lunghezza" separatamente per ogni nota.
L' istruzione " write(file_output,' '); " è inutile e ti darà problemi in lettura. Infatti il comando write separa automaticamente i dati scritti su file.
Nella funzione procedure "riproduci_suono(input:integer); " usi il comando delay.
Purtroppo, esso si affida ai clok della cpu, quindi non è affidabile.
Sei costratto a programmarti una funzione apposita.
Ultima modifica effettuata da Poggi Marco il 07/03/2010 alle 22:27
()
Newbie
Messaggi:
Iscritto:
Per il menù cercherò di provvedere domani, anch'io mi sono reso conto che è abbastanza macchinoso..ma ho letto robe che, a mio avviso, sono peggiori..
la funzione di registrazione è l'unica cosa che al momento (almeno sul mio pc) funge salva tutto. la mia idea è quella di salvare la frequenza della nota e la sua durata in un unico numero chiamato codificato che poi appunto verra decodificato e riportato ad essere 2 numeri separati..
ciò che al momento mi da fastidio è la difficoltà nell'uscita dalle funzioni del programma..una volta terminata una determinata funzione vi è per forza il bisogno di premere freccia in giù o freccia in su per tornare al menù principale..però la cosa che mi interesserebbe maggiormente è sapere se si sente qualcosa..
()
Newbie
Messaggi:
Iscritto:
Codice sorgente - presumibilmente Delphi
program riproduttore_multimediale;
uses crt;
var flag, stop: boolean ;
{Procedura per riprodurre il suono}
procedure riproduci_suono( input: integer ) ;
var
intensita, durata: integer ;
begin
intensita: = input mod 1000 ;
durata: = input- intensita;
sound( intensita) ;
delay( durata) ;
nosound;
end ;
{Procedura per registrare il suono}
procedure registra;
var
lunghezza, frequenza, codificato: integer ;
percorso: string [ 30] ;
nota: string [ 3] ;
uscita: boolean ;
file_output: textfile ;
tasto: char ;
begin
CLRSCR;
uscita: = false ;
write ( 'Percorso in cui salvare il file audio : ' ) ; readln ( percorso) ;
assign( file_output, percorso) ;
rewrite ( file_output) ;
repeat
repeat
clrscr;
textcolor( black) ;
gotoxy( 1, 1) ;
writeln ( 'Premi ESC per uscire (uscirà dopo aver digitato la nota da salvare)' ) ;
gotoxy( 20, 6) ;
write ( 'Nota (DO/RE/MI/FA/SOL/LA/SI) : ' ) ;
tasto: = readkey;
if tasto= #27 then uscita: = true ;
textcolor( red) ;
readln ( nota) ;
until ( nota= 'DO' ) or ( nota= 'RE' ) or ( nota= 'MI' ) or ( nota= 'FA' ) or ( nota= 'SOL' ) or ( nota= 'LA' ) or ( nota= 'SI' ) or uscita;
textcolor( black) ;
write ( 'Durata (in secondi) : ' ) ; readln ( lunghezza) ;
if nota= 'DO' then frequenza: = 262
else if nota= 'RE' then frequenza: = 294
else if nota= 'MI' then frequenza: = 330
else if nota= 'FA' then frequenza: = 349
else if nota= 'SOL' then frequenza: = 392
else if nota= 'LA' then frequenza: = 440
else if nota= 'SI' then frequenza: = 494 ;
codificato: = frequenza+ lunghezza* 1000 ;
append ( file_output) ;
write ( file_output, codificato) ;
write ( file_output, ' ' ) ;
close ( file_output) ;
until uscita;
end ;
{procedura per la riproduzione}
procedure riproduzione;
type contenitore= array [ 1.. 255] of integer ;
var
i, b: integer ;
letto: contenitore;
percorso: string [ 30] ;
file_input: textfile ;
begin
write ( 'Percorso file da riprodurre : ' ) ; readln ( percorso) ;
assign( file_input, percorso) ;
reset ( file_input) ;
i: = 1 ;
while not eof ( file_input) do
begin
read ( file_input, letto[ i] ) ;
i: = i+ 1 ;
end ;
b: = i;
i: = 1 ;
for i: = 1 to b do
begin
riproduci_suono( letto[ i] ) ;
end ;
end ;
{Menu}
procedure menu;
var
tasto: char ;
move : boolean ;
cont: integer ;
begin
cont: = 0 ;
flag: = false ;
move : = false ;
clrscr;
textbackground( white) ;
textcolor( white) ;
gotoxy( 1, 1) ; writeln ( 'Cosa vuoi fare?' ) ;
gotoxy( 30, 15) ; writeln ( 'Ascoltare musica' ) ;
gotoxy( 30, 17) ; writeln ( 'Registrare musica' ) ;
gotoxy( 30, 19) ; writeln ( 'Uscire' ) ;
repeat
stop: = false ;
if move = false then
begin
repeat
tasto: = readkey;
until ( tasto= #80 ) or ( tasto= #72 ) ;
if ( tasto= #80 ) then begin tasto: = ' ' ; cont: = cont+ 1 end ;
if ( tasto= #72 ) then begin tasto: = ' ' ; cont: = cont- 1 end ;
end ;
if cont= 4 then cont: = 1 ;
if cont=- 1 then cont: = 3 ;
move : = false ;
case cont of
1: begin
clrscr;
textcolor( white) ;
gotoxy( 1, 1) ; writeln ( 'Cosa vuoi fare?' ) ;
textcolor( red) ;
gotoxy( 30, 15) ; writeln ( 'Ascoltare musica' ) ;
textcolor( white) ;
gotoxy( 30, 17) ; writeln ( 'Registrare musica' ) ;
gotoxy( 30, 19) ; writeln ( 'Uscire' ) ;
repeat
begin
tasto: = readkey;
if tasto= #13 then
begin
riproduzione;
stop: = true
end ;
if tasto= #80 then begin cont: = cont+ 1 ; move : = true end ;
if tasto= #72 then begin cont: = cont- 1 ; move : = true end ;
end ;
until ( tasto= #13 ) or ( tasto= #80 ) or ( tasto= #72 ) or stop;
end ;
2: begin
clrscr;
textcolor( white) ;
gotoxy( 1, 1) ; writeln ( 'Cosa vuoi fare?' ) ;
gotoxy( 30, 15) ; writeln ( 'Ascoltare musica' ) ;
textcolor( red) ;
gotoxy( 30, 17) ; writeln ( 'Registrare musica' ) ;
textcolor( white) ;
gotoxy( 30, 19) ; writeln ( 'Uscire' ) ;
repeat
begin
tasto: = readkey;
if tasto= #13 then begin
registra;
stop: = true
end ;
if tasto= #80 then begin cont: = cont+ 1 ; move : = true end ;
if tasto= #72 then begin cont: = cont- 1 ; move : = true end ;
end ;
until ( tasto= #13 ) or ( tasto= #80 ) or ( tasto= #72 ) or stop;
end ;
3: begin
clrscr;
gotoxy( 1, 1) ; writeln ( 'Cosa vuoi fare?' ) ;
gotoxy( 30, 15) ; writeln ( 'Ascoltare musica' ) ;
gotoxy( 30, 17) ; writeln ( 'Registrare musica' ) ;
textcolor( red) ;
gotoxy( 30, 19) ; writeln ( 'Uscire' ) ;
repeat
begin
tasto: = readkey;
if tasto= #13 then
begin
writeln ( 'Bye bye :D' ) ; delay( 3000) ;
flag: = true
end ;
if tasto= #80 then begin cont: = cont+ 1 ; move : = true end ;
if tasto= #72 then begin cont: = cont- 1 ; move : = true end ;
end ;
until ( tasto= #13 ) or ( tasto= #80 ) or ( tasto= #72 ) ;
end ;
end ;
until flag OR stop;
end ;
{Programma}
begin
repeat
menu
until flag;
end .
So che è mostruosamente brutto il menu, ma vorrei saperer se qualcuno sente l'audio. Se qualcuno mi vuole aiutare per favore provi a registrare qualcosa prima e poi provi a riprodurre.
Poggi Marco (Member )
Guru
Messaggi: 969
Iscritto: 05/01/2010
Scusa Giarados, sono stato troppo critico, e non ho capito subito il metodo di registrazione del suono.
Ho provato il tuo programma e stranamente con Dev Pascal non funziona, mentre con il Turbo Pascal 7.0 funziona.
Ovviamente delay non è affidabile, ma ho creato una funzione per le pause a tempo.
Ecco il programma:
Codice sorgente - presumibilmente Delphi
program riproduttore_multimediale;
uses crt, dos;
type textfile = text;
var flag, stop: boolean ;
function tempo( var giorno: word ) : real ;
var h, m, s, s100: word ;
anno, mese, GiornoDellaSettimana: word ;
begin
GetTime ( h, m, s, s100) ;
GetDate( anno, mese, giorno, GiornoDellaSettimana) ;
tempo: = ( h + 0. 0) * 3600 + 60* m + s + s100/ 100 ;
end ;
procedure pausa( t: real ) ;
var t0, te: real ;
g, g0: word ;
begin
t0: = tempo( g0) ;
repeat
te: = tempo( g) ;
if g<>g0 then te: = te+ 86400 ;
until ( te- t0) >t;
end ;
{Procedura per riprodurre il suono}
procedure riproduci_suono( input: longint ) ;
var
intensita, durata: longint ;
begin
intensita: = input mod 1000 ;
durata: = input- intensita;
sound( intensita) ;
pausa( durata / 1000) ;
nosound;
end ;
{Procedura per registrare il suono}
procedure registra;
var
lunghezza, frequenza, codificato: integer ;
percorso: string [ 30] ;
nota: string [ 3] ;
uscita: boolean ;
file_output: textfile ;
tasto: char ;
begin
CLRSCR;
uscita: = false ;
write ( 'Percorso in cui salvare il file audio : ' ) ; readln ( percorso) ;
assign( file_output, percorso) ;
rewrite ( file_output) ;
repeat
repeat
clrscr;
textcolor( black) ;
gotoxy( 1, 1) ;
writeln ( 'Premi ESC per uscire (uscirà dopo aver digitato la nota da salvare)' ) ;
gotoxy( 20, 6) ;
write ( 'Nota (DO/RE/MI/FA/SOL/LA/SI) : ' ) ;
tasto: = readkey;
if tasto= #27 then uscita: = true ;
textcolor( red) ;
readln ( nota) ;
until ( nota= 'DO' ) or ( nota= 'RE' ) or ( nota= 'MI' ) or ( nota= 'FA' ) or ( nota= 'SOL' ) or ( nota= 'LA' ) or ( nota= 'SI' ) or uscita;
textcolor( black) ;
write ( 'Durata (in secondi) : ' ) ; readln ( lunghezza) ;
if nota= 'DO' then frequenza: = 262
else if nota= 'RE' then frequenza: = 294
else if nota= 'MI' then frequenza: = 330
else if nota= 'FA' then frequenza: = 349
else if nota= 'SOL' then frequenza: = 392
else if nota= 'LA' then frequenza: = 440
else if nota= 'SI' then frequenza: = 494 ;
codificato: = frequenza+ lunghezza* 1000 ;
append ( file_output) ;
write ( file_output, codificato) ;
write ( file_output, ' ' ) ;
until uscita;
close ( file_output) ; (* Ho spostato il comando close fuori dal ciclo *)
end ;
{procedura per la riproduzione}
procedure riproduzione;
var
c: longint ;
percorso: string [ 80] ;
file_input: textfile ;
begin
write ( 'Percorso file da riprodurre : ' ) ; readln ( percorso) ;
assign( file_input, percorso) ;
reset ( file_input) ;
while not eof ( file_input) do
begin
read ( file_input, c) ;
riproduci_suono( c) ; (* non salvo più i dati su un' array, ma *)
(* li passo direttamente alla funzione *)
end ; (* riproduci_suono *)
close ( file_input) ;
end ;
{Menu}
procedure menu;
var
tasto: char ;
move : boolean ;
cont: integer ;
begin
cont: = 0 ;
flag: = false ;
move : = false ;
clrscr;
textbackground( white) ;
textcolor( white) ;
gotoxy( 1, 1) ; writeln ( 'Cosa vuoi fare?' ) ;
gotoxy( 30, 15) ; writeln ( 'Ascoltare musica' ) ;
gotoxy( 30, 17) ; writeln ( 'Registrare musica' ) ;
gotoxy( 30, 19) ; writeln ( 'Uscire' ) ;
repeat
stop: = false ;
if move = false then
begin
repeat
tasto: = readkey;
until ( tasto= #80 ) or ( tasto= #72 ) ;
if ( tasto= #80 ) then begin tasto: = ' ' ; cont: = cont+ 1 end ;
if ( tasto= #72 ) then begin tasto: = ' ' ; cont: = cont- 1 end ;
end ;
if cont= 4 then cont: = 1 ;
if cont=- 1 then cont: = 3 ;
move : = false ;
case cont of
1: begin
clrscr;
textcolor( white) ;
gotoxy( 1, 1) ; writeln ( 'Cosa vuoi fare?' ) ;
textcolor( red) ;
gotoxy( 30, 15) ; writeln ( 'Ascoltare musica' ) ;
textcolor( white) ;
gotoxy( 30, 17) ; writeln ( 'Registrare musica' ) ;
gotoxy( 30, 19) ; writeln ( 'Uscire' ) ;
repeat
begin
tasto: = readkey;
if tasto= #13 then
begin
riproduzione;
stop: = true
end ;
if tasto= #80 then begin cont: = cont+ 1 ; move : = true end ;
if tasto= #72 then begin cont: = cont- 1 ; move : = true end ;
end ;
until ( tasto= #13 ) or ( tasto= #80 ) or ( tasto= #72 ) or stop;
end ;
2: begin
clrscr;
textcolor( white) ;
gotoxy( 1, 1) ; writeln ( 'Cosa vuoi fare?' ) ;
gotoxy( 30, 15) ; writeln ( 'Ascoltare musica ' ) ;
textcolor( red) ;
gotoxy( 30, 17) ; writeln ( 'Registrare musica' ) ;
textcolor( white) ;
gotoxy( 30, 19) ; writeln ( 'Uscire ' ) ;
repeat
begin
tasto: = readkey;
if tasto= #13 then begin
registra;
stop: = true
end ;
if tasto= #80 then begin cont: = cont+ 1 ; move : = true end ;
if tasto= #72 then begin cont: = cont- 1 ; move : = true end ;
end ;
until ( tasto= #13 ) or ( tasto= #80 ) or ( tasto= #72 ) or stop;
end ;
3: begin
clrscr;
gotoxy( 1, 1) ; writeln ( 'Cosa vuoi fare?' ) ;
gotoxy( 30, 15) ; writeln ( 'Ascoltare musica' ) ;
gotoxy( 30, 17) ; writeln ( 'Registrare musica' ) ;
textcolor( red) ;
gotoxy( 30, 19) ; writeln ( 'Uscire' ) ;
repeat
begin
tasto: = readkey;
if tasto= #13 then
begin
writeln ( 'Bye bye ' ) ; delay( 3000) ;
flag: = true
end ;
if tasto= #80 then begin cont: = cont+ 1 ; move : = true end ;
if tasto= #72 then begin cont: = cont- 1 ; move : = true end ;
end ;
until ( tasto= #13 ) or ( tasto= #80 ) or ( tasto= #72 ) ;
end ;
end ;
until flag OR stop;
end ;
{Programma}
begin
repeat
menu
until flag;
end .
Ultima modifica effettuata da Poggi Marco il 09/03/2010 alle 18:42