I'm currently writing a program to check if a user inputs 0.0 or any variation of 0. However, if I were to write the following code with the user input as 0.0 I don't get either right or wrong as an output the program just ends.
int main(){
double num;
cin >> num;
if (num==0){
cout << "wrong";
}
else {
cout <<"right";
}
}
Can someone explain the reason I don't get anything and possibly how to do the comparison I need?
Update: The code I was running is correct, it didn't output because I wasn't calling the function in main. The only reason my post has the code in main was to simplify my question.