Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // LOTTOTIPPtrefferZahl
- #include<stdio.h>
- #include<stdlib.h>
- #include<time.h>
- main()
- {
- srand(time(NULL));
- int i,j,lotto[6],ziehung[6],treffer;
- system("chcp 1252");
- while(1>0)
- {
- system("cls");
- // LOTTOTIPP ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- for(i=0;i<6;i=i+1)
- {
- lotto[i]=rand()%49+1;
- for(j=0;j<i;j=j+1)
- {
- if(lotto[j]==lotto[i])
- {
- i=i-1;
- break;
- }
- }
- }
- printf("Lottotipp:\n");
- for(i=0;i<6;i=i+1) printf("%i ",lotto[i]);
- // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- // LOTTOZIEHUNG +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- for(i=0;i<6;i=i+1)
- {
- ziehung[i]=rand()%49+1;
- for(j=0;j<i;j=j+1)
- {
- if(ziehung[j]==ziehung[i])
- {
- i=i-1;
- break;
- }
- }
- }
- printf("\n\nLottoziehung:\n");
- for(i=0;i<6;i=i+1) printf("%i ",ziehung[i]);
- // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- // TREFFERERMITTLUNG ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- treffer=0;
- for(i=0;i<6;i++)
- {
- for(j=0;j<6;j++)
- {
- if(lotto[i]==ziehung[j]) treffer++;
- }
- }
- printf("\n\nEs gab %i Treffer.\n\n\n",treffer);
- // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- system("pause");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement