Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Lottogenerator;
- const iArray=6;
- const lotto=49;
- const Tipp=6;
- const icounteran=6;
- const counter = 1000000;
- type iZahlen5 = array[1..icounteran] of integer;
- type iZahlen = array[1..iArray] of integer;
- type iZahlen2 = array[1..lotto] of integer;
- type iZahlen3 = array[1..Tipp] of integer;
- type iZahlen4 = array[1..counter] of integer;
- var iWert:iZahlen;
- var iLotto:iZahlen2;
- var iTipp:iZahlen3;
- var icounter:iZahlen4;
- var counteran:iZahlen5;
- var iIndex, tausch, dummy, abbruch, iAnzahl, iZiehungen, iDurch, flag, icounteran: integer;
- begin
- Randomize;
- write('Wie oft wollen Sie ziehen: '); readln(iZiehungen);
- for iIndex := 1 to Tipp do
- begin
- write(iIndex,'. Zahl '); readln(iTipp[iIndex]);
- end;
- //Zufallszahlen zugeteilt(keine doppelten Zahlen)
- for iDurch:= 1 to iZiehungen do
- begin
- for iIndex := 1 to iArray do
- begin
- repeat
- iWert[iIndex] := Random(49)+1;
- abbruch := 0;
- for iAnzahl := 1 to iArray do
- begin
- If iIndex = iAnzahl then
- begin
- continue;
- end;
- If iWert[iIndex] = iWert[iAnzahl] then
- begin
- abbruch := 1;
- end;
- end;
- until(abbruch=0);
- iLotto[iWert[iIndex]]:= iLotto[iWert[iIndex]]+1;
- for flag := 1 to Tipp do
- begin
- if iTipp[flag]=iWert[iIndex] then
- begin
- icounter[iDurch]:= icounter[iDurch]+1
- end;
- end;
- end;
- writeln('Die Lotto Zahlen lauten: ');
- writeln;
- For iIndex := 1 to iArray do
- begin
- writeln(iIndex,'. Zahl: ',iWert[iIndex]);
- end;
- end;
- //Sortierung der Zufallszahlen
- repeat
- tausch := 0;
- for iIndex := 1 to iArray-1 do
- begin
- if iWert[iIndex]>iWert[iIndex+1] then
- begin
- dummy := iWert[iIndex];
- iWert[iIndex] := iWert[iIndex+1];
- iWert[iIndex+1] := dummy;
- tausch :=1;
- end;
- end;
- until(tausch=0);
- readln;
- //Ausgabe der sortierten Zahlen
- readln;
- for iIndex:= 1 to Lotto do
- begin
- writeln(iIndex,'. Stelle ',iLotto[iIndex]);
- end;
- for iIndex:= 1 to Tipp do
- begin
- writeln(iTipp[iIndex]);
- end;
- for iIndex:= 1 to iZiehungen do
- begin
- if icounter[iIndex]> 2 then
- begin
- icounteran[icounter[iIndex]]:= icounteran[icounter[iIndex]]+1;
- writeln(iIndex,'. Ziehung: ',icounter[iIndex],' Richtige');
- end;
- for iIndex:= 3 to ianzahl do
- begin
- writeln(iIndex,'. Richtige: ',icounteran[iIndex]);
- end;
- end;
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement