Quando passo o mouse por cima do abs a mensagem que aparece é "abs is ambigous" e eu nao sei como consertar. `#include //input-output library using namespace std;
int main () { cout << "****" << endl; //cout will print & endl will jump to the next line cout << "* Welcome to the Guessing Game " << endl; cout << "***" << endl;
const int SECRET_NUMBER = 42;
bool incorrect_guess = true;
int attempts = 0;
double points = 1000.0;
while(incorrect_guess){
attempts ++;
int guess;
cout << "Attempts: " << attempts << endl;
cout << "What is your guess?" << endl;
cin >> guess; //guess input
double lost_points = abs(guess - SECRET_NUMBER) / 2.0;
points -= lost_points;
cout << "You guessed: " << guess << endl;
bool guessed = guess == SECRET_NUMBER;
bool bigger = guess > SECRET_NUMBER;
if(guessed){
cout << "Congratulations! You've guessed the secret number!" << endl;
incorrect_guess = false;
}
else if(bigger){
cout << "The number you guessed was bigger than the secret number!" << endl;
}
else{
cout << "The number you guessed was smaller than the secret number!" << endl;
}
}
cout << "Game Over!" << endl;
cout << "You guessed after " << attempts << " attempts!" << endl;
cout.precision(2);
cout << fixed;
cout << "Score: " << points << endl;
}`