Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Lotto;
- const iDurchlauf=1000;
- const iZahl=6;
- const iPruef=49;
- type mWert=array [1..iDurchlauf,1..iZahl] of Integer;
- var mFeld:mWert;
- type mA=array [1..iPruef] of Integer;
- var mB:mA;
- type iTipp=array [1..iZahl] of Integer;
- var Tipp:iTipp;
- type iCount=array[1..iDurchlauf] of Integer;
- var Count:iCount;
- var iIndex,tausch,iDurch,ivorhanden,dummy,a,Flag,iAnzahl:Integer;
- begin
- Randomize;
- write('Bitte geben sie ihren Tipp ein: ');
- For iIndex:=1 to iZahl do
- begin
- readln(Tipp[iIndex]);
- end;
- repeat
- tausch:=0;
- For iIndex:=1 to 5 do
- begin
- If Tipp[iIndex] > Tipp[iIndex+1] Then
- begin
- dummy:=Tipp[iIndex];
- Tipp[iIndex]:=Tipp[iIndex+1];
- Tipp[iIndex+1]:=dummy;
- tausch:=1;
- end;
- end;
- until(tausch=0);
- write('Ihr Tipp lautet: ');
- For iIndex:=1 to iZahl do
- begin
- write(' ',Tipp[iIndex]);
- end;
- readln();
- For iDurch:=1 to iDurchlauf do
- begin
- For iIndex:=1 to iZahl do
- begin
- repeat
- MFeld[iDurch,iIndex] := random(49) + 1;
- ivorhanden:=0;
- For iAnzahl:=1 to iZahl do
- begin
- If iIndex = iAnzahl Then
- begin
- continue;
- end;
- If mFeld[iDurch,iIndex] = mFeld[iDurch,iAnzahl] Then
- begin
- ivorhanden:=1;
- end;
- end;
- until(ivorhanden=0);
- end;
- end;
- For iDurch:=1 to iDurchlauf do
- begin
- Flag:=0;
- For iIndex:=1 to iZahl do
- begin
- For a:=1 to iZahl do
- begin
- If Tipp[iIndex] = mFeld[iDurch,a] Then
- begin
- Flag:=Flag+1;
- end;
- end;
- end;
- Count[Flag]:= Count[Flag]+1;
- end;
- For iDurch:=3 to iZahl do
- begin
- writeln('Du hattest so oft ',iDurch,' uebereinstimmungen',Count[iDurch]);
- end;
- readln();
- //Wie oft jede Zahl gezogen wurde
- For iDurch:=1 to iDurchlauf do
- begin
- For iIndex:=1 to iZahl do
- begin
- For a:=1 to iPruef do
- begin
- If mFeld[iDurch,iIndex] = a Then
- begin
- mB[a]:= mb[a]+1;
- end;
- end;
- end;
- end;
- For iIndex:=1 to iPruef do
- begin
- writeln('Die Zahl ',iIndex,' wurde so oft gezogen: ',mB[iIndex]);
- end;
- readln();
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement