Batalha naval c++
#include<iostream>
#include<iomanip>
using namespace std;
int main (){ //variaveis int tab[100], pos1, pos2, pos3; int direcao; srand(time(NULL)); while(true){ for( int i=0; i<100; i++){ tab[i]= 0; } pos1 = rand()%100; tab[pos1]= 1; if( pos1 == 0){ do{ pos2 = rand()%100; }while(!((pos2 == pos1+ 1) || (pos2 == pos1+ 10) || (pos2 == pos1+ 11))); } else if (pos1 == 9){ do{ pos2 = rand()%100; }while(!((pos2 == pos1- 1) || (pos2 == pos1+ 9) || (pos2 == pos1+ 10))); } else if (pos1 == 90){ do{ pos2 = rand()%100; }while(!((pos2 == pos1- 9) || (pos2 == pos1 - 10) || (pos2 == pos1+ 1))); } else if (pos1 == 99){ do{ pos2 = rand()%100; }while(!((pos2 == pos1- 1) || (pos2 == pos1 - 10) || (pos2 == pos1- 11))); } else if( pos1 > 1 && pos1 < 8){ do{ pos2 = rand()%100; }while(!((pos2 == pos1-1) || (pos2 == pos1+ 1) || (pos2 == pos1+ 9) || (pos2 == pos1+ 10) || (pos2 == pos1+ 11))); } else if( pos1 == 1){ do{ pos2 = rand()%100; }while(!((pos2 == pos1-1) || (pos2 == pos1+ 1) || (pos2 == pos1+ 10) || (pos2 == pos1+ 11))); } else if( pos1 == 8){ do{ pos2 = rand()%100; }while(!((pos2 == pos1-1) || (pos2 == pos1+ 1) || (pos2 == pos1+ 10) || (pos2 == pos1+ 9))); } else if( pos1 == 10){ do{ pos2 = rand()%100; }while(!((pos2 == pos1+1) || (pos2 == pos1- 10) || (pos2 == pos1+ 10) || (pos2 == pos1+ 11))); } else if( pos1 == 19){ do{ pos2 = rand()%100;