← Back to Classes
Question 60
Temperature Equality (operator==)
Temperature Equality (operator==)
You are comparing temperatures for a thermostat.
Create a class Temperature that stores degrees Celsius as an int.
Requirements:
1) Constructor Temperature(int c)
2) int getC() const
3) Overload operator== to compare if two Temperature objects have the same Celsius value
Do NOT write a main function.Expected Output:
equal not equal
= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
ClassesOperator Overloading
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.