Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- struct baralho
- {
- char personagem[41], personagem2[41];
- int k,j,y[50];
- };
- int main()
- {
- struct baralho vsf[50];
- struct baralho aux;
- int n,i,j;
- int count = 0;
- char sorteio[50];
- scanf("%d",&n);
- for (i = 0; i < n; i++)
- {
- // printf("\n");
- scanf(" \n%[^\n]",vsf[i].personagem );
- scanf("%d",&vsf[i].k );
- for (j = 0; j < vsf[i].k; j++)
- {
- scanf("%d",&vsf[i].y[j] );
- }
- scanf(" \n%[^\n]",vsf[i].personagem2 );
- //printf("\n");
- }
- for ( i = 0; i < n- 1; i++)
- {
- for ( j = i + 1; j < n; j++)
- {
- if(strcmp(vsf[i].personagem,vsf[j].personagem) > 0)
- {
- aux = vsf[i];
- vsf[i] = vsf[j];
- vsf[j] = aux;
- }
- }
- }
- scanf(" %[^\n]s", sorteio );
- for (i = 0; i < n; i++)
- {
- if (strcmp(sorteio,vsf[i].personagem)==0)
- {
- printf("contador: %d\n",i );
- }
- for (j = 0; j < vsf[i].k; j++)
- {
- printf("carta: %d\n",vsf[i].y[j % vsf[i].k]);
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement