Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- void inic_rando(void) //inicia gerador de números-copiei
- { long ultime;
- time(&ultime);
- srand((unsigned) ultime);
- }
- void star_vetor(int vetor[5])
- { int cont;
- for(cont=0;cont<5;cont++)
- vetor[cont]=0;
- }
- void inicializa (int jogo[5][12])
- {
- int cont, cont1,aux=0;
- for(cont=0;cont<5;cont++)
- {
- for(cont1=0;cont1<12;cont1++)
- { aux= aux+1;
- jogo[cont1][cont]=aux;
- }
- }
- }
- void mostra(int jogo[][12])
- {
- int cont, cont1;
- for(cont=0;cont<5;cont++)
- {
- for(cont1=0;cont1<12;cont1++)
- {
- printf(" %2d ",jogo[cont1][cont]);
- }
- printf("\n");
- }
- }
- void main (void)
- {
- int k,cont,cont1,jogo[5][12],sorte[5];
- printf("\nBEM VINDO AO GERADOR DE SORTEIOS\n");
- star_vetor(sorte);
- for(k=0;k<5;k++)
- {
- inic_rando();
- sorte[k]= rand() %60;
- if(sorte[k]==0){
- sorte[k]=rand() %60;}
- printf( "%d ", sorte[k]);
- }
- printf("\n");
- inicializa(jogo);
- mostra(jogo);
- for(cont=0;cont<5;cont++)
- {
- for(cont1=0;cont1<12;cont1++)
- { if(sorte[cont]==jogo[cont][cont1])
- jogo[cont][cont1]=00;
- }
- }
- printf("\n\n");
- mostra(jogo);
- exit;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement