Escolar Documentos
Profissional Documentos
Cultura Documentos
import javax.swing.JOptionPane;
public class JogoDaVelha {
while(!ganhou){
System.out.println(out);
int coluna =
Integer.parseInt(posicao.substring(2,3));
if(jogo[linha][coluna] != 0){
}else{
jogo[linha][coluna] = jogador;
int vencedor = 0;
if((jogo[0][0]==jogo[1][1])&&
(jogo[1][1]==jogo[2][2])&&
(jogo[0][0]!=0)){
vencedor = jogo[0][0];
if((jogo[0][2]==jogo[1][1])&&
(jogo[1][1]==jogo[2][0])&&
(jogo[0][2]!=0)){
vencedor = jogo[0][2];
//verifica linha
if((jogo[i][0]==jogo[i][1])&&
(jogo[i][1]==jogo[i][2])&&
(jogo[i][0]!=0)){
vencedor = jogo[i][0];
//verifica coluna
if((jogo[0][i]==jogo[1][i])&&
(jogo[1][i]==jogo[2][i])&&
(jogo[0][i]!=0)){
vencedor = jogo[0][i];
if(vencedor!=0){
ganhou = true;
System.out.println("O Vencedor é o
Jogador Número" + vencedor);
break;
TESTE PATERNIDADE
{"ATGC","TTTT","GGGG","AGCT"},
//dna mae
{"TTTT","GGGG","CCCC","AAAA"},//dna pai
};
dna[2][0] = dnaPai.substring(0,4);
dna[2][1] = dnaPai.substring(4,8);
dna[2][2] = dnaPai.substring(8,12);
dna[2][3] = dnaPai.substring(12);*/
int i = 0;
int j = 0;
if(dna[0][i].equals(dna[1][j])){
dnaPaiMae = 1;
soma+=1;
}else{
if(dna[0][i].equals(dna[2][j])){
dnaPaiMae = 2;
soma+=2;
j++;
if(dnaPaiMae==-1){
resultado = false;
i++;
if((resultado)&&(soma==6)){
}else{
}
}
CRIPTOGRAFIA
import javax.swing.*;
{-1,-1,-1,-1,-1,-1}, //senha
int op =
Integer.parseInt(JOptionPane.showInputDialog("Digite: \n" +
"2 - Descriptografar"));
if(op==1){
int posInicial = 0;
if(posEspaco != -1){
secreto[1][i] =
Integer.parseInt(senha.substring(posInicial, posEspaco));
}else{
secreto[1][i] =
Integer.parseInt(senha.substring(posInicial));
}
secreto[2][i] = secreto[1][i]*secreto[0][i];
}else{
if(op==2){
int posInicial = 0;
if(posEspaco != -1){
secreto[2][i] =
Integer.parseInt(senha.substring(posInicial, posEspaco));
}else{
secreto[2][i] =
Integer.parseInt(senha.substring(posInicial));
secreto[1][i] = secreto[2][i]/secreto[0]
[i];
}else{
System.out.println(msg);
}
ROTACIONAR UMA IMAGEM
public class RotacionarImagem {
public static void main(String[] args) {
{" "," "," "," "," "," "," "," "," "," "," ","
"," "," "," "," "}, //1
{" "," "," "," "," "," "," "," "," "," "," ","
"," "," "," "," "}, //2
{" "," "," "," "," "," "," "," "," "," "," ","
"," "," "," "," "}, //3
{" "," "," "," "," "," "," "," "," "," "," ","
"," "," "," "," "},//4
{" "," "," "," "," "," "," "," "," "," "," ","
"," "," "," "," "},//5
{" "," "," "," "," "," "," "," "," "," "," ","
"," "," "," "," "},//6
{" "," "," "," "," "," "," "," "," "," "," ","
"," "," "," "," "},//7
{" "," "," "," "," "," "," "," "," "," "," ","
"," "," "," "," "},//8
{" "," "," "," "," "," "," "," "," "," "," ","
"," "," "," "," "},//9
{" "," "," "," "," "," "," "," "," "," "," ","
"," "," "," "," "},//10
{" "," "," "," "," "," "," "," "," "," "," ","
"," "," "," "," "},//11
{" "," "," "," "," "," "," ","*","*"," "," ","
"," "," "," "," "},//12
imagemRotacionada[j][15-i] = imagem[i][j];
imagem = imagemRotacionada;
//MOSTRA IMAGEM
msg+= imagem[i][j];
System.out.println(msg);