Und zwar sagt mein Debugger ich hätte kein ende.
Kann mir da jemand helfen? Das Programm soll eine Passwortabfrage sowie die Auswahl zwischen Programm beenden oder Taschenrechner wählen haben.
Bitte sagt wenn ihr meinen Fehler entdeckt habt.
program Passwortabfrage;
uses crt;
var Passwort1 : string[15];
Passwort2 : string[15];
zahl1, zahl2: integer;
auswahl : char;
auswahl1 : char;
Begin
Window (1, 1, 80, 25);
TextBackground (lightgreen);
clrscr;
window (15, 20, 20, 15);
TextBackground (lightgray);
TextColor (black);
gotoxy (10, 15);
writeln ('Geben Sie ein Passwort mit bis zu 15 Zeichen ein: ');
textcolor (black);
textbackground (lightgreen);
gotoxy (25, 16);
readln (Passwort1);
clrscr;
repeat;
window (15, 20, 20, 15);
Textbackground (lightgray);
Textcolor (black);
gotoxy (10, 15);
writeln ('Ihr Passwort wurde akzeptiert. Drücken Sie "Enter" um fortzufahren...');
readkey;
clrscr;
window (1, 1, 80, 25);
textbackground (lightgreen);
textcolor (black);
clrscr;
window (15, 20, 20, 15);
Textbackground (lightgray);
Textcolor (black);
gotoxy (10, 15);
writeln ('Was möchten Sie tun? [T]aschenrechner oder [b]eenden ?');
clrscr;
case auswahl1 of
't', 'T' :begin
repeat
writeln('Dies ist ein Rechner. Sie können das Programm beenden, indem Sie "e" drücken.');
write ('Geben Sie bitte die erste Zahl ein: ');
readln (zahl1);
write ('Geben Sie bitte die zweite Zahl ein: ');
readln (zahl2);
writeln ('Welche Rechenart möchten Sie ausführen?');
write ('[A]ddition [S]ubtraktion');
writeln (' [M]ultiplikation [D]ivision');
readln (Auswahl);
case Auswahl of
'a', 'A' :begin
write(zahl1);
write(' + ');
write(zahl2);
write(' = ');
writeln (zahl1 + zahl2);
end;
's', 'S' :begin
write(zahl1);
write(' + ');
write(zahl2);
write(' = ');
writeln(zahl1 + zahl2);
end;
'm', 'M' :begin
write(zahl1);
write(' * ');
write(zahl2);
write(' = ');
writeln(zahl1 * zahl2);
end;
'd', 'D' :begin
write(zahl1);
write(' / ');
write(zahl2);
write(' = ');
write(zahl1 div zahl2);
write(' Rest ');
writeln(zahl1 mod zahl2);
end;
'e', 'E' :begin
write ('Auf Wiedersehen');
end;
else
begin
writeln('Ungültige Eingabe');
end;
end;
until auswahl = 'e';
end;
'b', 'B':begin
window (15, 20, 20, 15);
Textbackground (lightgray);
Textcolor (black);
gotoxy (10, 15);
writeln ('Ihr Passwort lautete: ');
textcolor (black);
textbackground (lightgreen);
gotoxy (10, 16);
readln (Passwort2);
if Passwort2 = Passwort1 then
begin
gotoxy (1, 20);
writeln ('Korrekt. Sie können das Programm mit Druck einer beliebigen Taste beenden...');
end;
if Passwort2 <> Passwort1 then
begin
textcolor (red);
writeln ('Falsch!!! Drücken Sie eine Taste um das Passwort erneut einzugeben.');
readkey;
clrscr;
end;
end;
until Passwort2=Passwort1;
readkey;
end.
Dieser Beitrag wurde von mo bearbeitet: 03. Dezember 2004 - 18:17

Hilfe
Neues Thema
Antworten

Nach oben


