You don't need the first if statement. The second if-else will accomplish the same with or without it. That should remove the compiler suggestion.
if (w1 == 'd' && w2 == 'u' && w3 == 'c' && w4 == 'k') {
cout << "The word is correct \n";
}
else if (answer == error) {
cout << " You got 5 strike you lost \n";
}