Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

202
Visualizações
Whenever I enter any number between 1 and 6, it is only showing missed and continuously running

I was trying the basic battleship game but problem is whenever I enter the input, the loop terminates and if I remove "sunk=true" then alert only shows "missed" which runs infinitely. what should be the code? ![enter image description here][2]

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

There is a few things I would update, but I don't want to give you everything at once as this looks like a school project. Your "pro" variable should be inside the while loop. If you remove "sunk=true" the while loop will run forever as pro does not equal any of the locations (second else if). Pro is outside of the loop so you never get prompted for a new number and it continuously hits missed indefinitely.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda