โ Back to Classes
Question 85
Temperature Range Shift (operator+ and operator<<)
Temperature Range Shift (operator+ and operator<<)
You are adjusting an allowed temperature range by a delta. Create a class TemperatureRange that stores TWO ints: lowC and highC. Requirements: 1) Constructor TemperatureRange(int lowC, int highC) 2) operator+(int delta) returns a NEW TemperatureRange where BOTH lowC and highC are increased by delta 3) operator<< prints like: lowC-highC C Example: 20-25C Do NOT write a main function.
Expected Output:
23-28C -5-0C
Topics:
ClassesOperator Overloading
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.