Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. program Lotto;
  2. const iDurchlauf=1000;
  3. const iZahl=6;
  4. const iPruef=49;
  5.  
  6. type mWert=array [1..iDurchlauf,1..iZahl] of Integer;
  7. var mFeld:mWert;
  8. type mA=array [1..iPruef] of Integer;
  9. var mB:mA;
  10. type iTipp=array [1..iZahl] of Integer;
  11. var Tipp:iTipp;
  12. type iCount=array[1..iDurchlauf] of Integer;
  13. var Count:iCount;
  14.  
  15. var iIndex,tausch,iDurch,ivorhanden,dummy,a,Flag,iAnzahl:Integer;
  16.  
  17. begin
  18. Randomize;
  19. write('Bitte geben sie ihren Tipp ein: ');
  20. For iIndex:=1 to iZahl do
  21. begin
  22. readln(Tipp[iIndex]);
  23. end;
  24.  
  25. repeat
  26. tausch:=0;
  27. For iIndex:=1 to 5 do
  28. begin
  29. If Tipp[iIndex] > Tipp[iIndex+1] Then
  30. begin
  31. dummy:=Tipp[iIndex];
  32. Tipp[iIndex]:=Tipp[iIndex+1];
  33. Tipp[iIndex+1]:=dummy;
  34. tausch:=1;
  35. end;
  36. end;
  37. until(tausch=0);
  38.  
  39. write('Ihr Tipp lautet: ');
  40. For iIndex:=1 to iZahl do
  41. begin
  42. write(' ',Tipp[iIndex]);
  43. end;
  44.  
  45. readln();
  46.  
  47. For iDurch:=1 to iDurchlauf do
  48. begin
  49. For iIndex:=1 to iZahl do
  50. begin
  51. repeat
  52. MFeld[iDurch,iIndex] := random(49) + 1;
  53. ivorhanden:=0;
  54. For iAnzahl:=1 to iZahl do
  55. begin
  56. If iIndex = iAnzahl Then
  57. begin
  58. continue;
  59. end;
  60. If mFeld[iDurch,iIndex] = mFeld[iDurch,iAnzahl] Then
  61. begin
  62. ivorhanden:=1;
  63. end;
  64. end;
  65. until(ivorhanden=0);
  66. end;
  67. end;
  68.  
  69. For iDurch:=1 to iDurchlauf do
  70. begin
  71. Flag:=0;
  72. For iIndex:=1 to iZahl do
  73. begin
  74. For a:=1 to iZahl do
  75. begin
  76. If Tipp[iIndex] = mFeld[iDurch,a] Then
  77. begin
  78. Flag:=Flag+1;
  79. end;
  80. end;
  81. end;
  82. Count[Flag]:= Count[Flag]+1;
  83. end;
  84.  
  85. For iDurch:=3 to iZahl do
  86. begin
  87. writeln('Du hattest so oft ',iDurch,' uebereinstimmungen',Count[iDurch]);
  88. end;
  89.  
  90. readln();
  91.  
  92. //Wie oft jede Zahl gezogen wurde
  93. For iDurch:=1 to iDurchlauf do
  94. begin
  95. For iIndex:=1 to iZahl do
  96. begin
  97. For a:=1 to iPruef do
  98. begin
  99. If mFeld[iDurch,iIndex] = a Then
  100. begin
  101. mB[a]:= mb[a]+1;
  102. end;
  103. end;
  104. end;
  105. end;
  106.  
  107. For iIndex:=1 to iPruef do
  108. begin
  109. writeln('Die Zahl ',iIndex,' wurde so oft gezogen: ',mB[iIndex]);
  110. end;
  111.  
  112. readln();
  113. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement