import java.util.Scanner;
import java.util.Random;
public class PROJETO {
public static int tam = 10;
public static int a = 0;
public static int Sorteia ( int A [ ] ) {
J jht = new J ( );
Random random = new Random ( );
int i, r, temp;
for ( i = 1; i < tam; i++ ){
A [ i ] = i;
}
jht.textcolor ( jht.BLACK );
jht.gotoxy ( ( int ) 16, ( int ) 21 );
for ( i = 1; i < tam; i++ )
System.out.printf ( " %2d", A [ i ] );
for ( i = 1; i < tam; i++ ) {
r = random.nextInt ( 9 );
if ( r == 0 )
r = 9;
temp = A [ i ];
A [ i ] = A [ r ];
A [ r ] = temp;
}
return 0;
}
public static void main ( String [ ] args ) {
int A [ ] = new int [ tam ];
int vet [ ] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
J jht = new J ( );
jht.textbackground ( jht.WHITE );
jht.Moldura ( ( short ) 1, ( short ) 24, ( short ) 2, ( short ) 78 );
jht.title ( " " );
int i, j, lenv;
Sorteia ( A );
jht.textcolor ( jht.LIGHTBLUE );
for ( i = 1; i < tam; i++ ) {
if ( i == 1 ) {
jht.gotoxy ( ( int ) 30, ( int ) 7 );
}
if ( i == 4 ) {
jht.gotoxy ( ( int ) 30, ( int ) 12 );
}
if ( i == 7 ) {
jht.gotoxy ( ( int ) 30, ( int ) 17 );
}
System.out.printf ( " %2d ", A [ i ] );
}
/////////////////////////////////////////////////////
jht.getche ( );
}
}
Nenhum comentário:
Postar um comentário
Observação: somente um membro deste blog pode postar um comentário.