I have a while loop in my program. It's a simplified Battleships game, and this is the part where you select a space to bomb. The computers' numbers are randomly generated earlier on.
My problem is, that whatever number is entered, the console returns a "HIT!". I think my problem lies within the initial "IF" statement, but I'm not completely sure why.
Any help would be greatly appreciated :)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
while (shipCount > 0)
{
cout << "Select a number between 26 and 50 to bomb" << endl;
cin >> playerPick;
if (playerPick == compAirCarr || compBatt || compDest || compSub || compPatrol)
{
cout << "HIT!" << endl;
cout << "Please enter another number to bomb" << endl;
shipCount--;
}
else cout << "MISS!" << endl;
cout << "Computer's turn" << endl;
}