Scroll through an array and validate repeated numbers

1

I am doing a final work in the first semester in BCC course and I need to do a Mega Sena algorithm with the following characteristics:

  • Maximum of 10 players
  • Each player must bet a minimum of 6 numbers and a maximum of 15 numbers
  • Valid numbers range from 1 to 60
  • Bets can not be repeated

The language used is Portugol, but we use a specific platform created by students of the University, so there are small variations in the semantics of the code in relation to the common Visualg.

My question is with regard to only a specific part of the code that could not resolve the betting part does not recur. If the user bets the number 1, the number 1 can no longer be used by anyone. Here is the code image.

I suppose the resolution to this problem can be solved by traversing the array completely and checking each bet, but I could not find a working method for this.

If you can help, feel free to use the C language itself.

    
asked by anonymous 28.05.2014 / 00:27

1 answer

1

Before the [counter1] [counter2] vector receives the bet, loop (to ... knife) to check if the informed bet is already inside the vector. If so, ask the user to enter the number again.

Something like:

leia(apostas);

para (contador3 de 1 ate 15) faca
       se (vetor[contador1][contador3] = apostas)
          ir para (goto) leia(apostas);      
fimpara
    
28.05.2014 / 01:07