124. Abstract Sensor Debugging

You are given firmware-style C++ code that defines a generic sensor interface.

The base class declares a required operation for reading a sensor value, but the concrete sensor implementation is incomplete.

As a result, the program fails to compile even though the application logic is correct.

In embedded systems, abstract interfaces are used to enforce driver contracts at build time.

Your task is to correct the implementation so that the concrete sensor fully satisfies the interface requirements.

You must not modify the application logic.

Program Flow:

  1. The program reads a signed integer value from standard input.
  2. A concrete temperature sensor object is created using the input value.
  3. The object is referenced through a base sensor interface pointer.
  4. The sensor value is read via the abstract interface.
  5. The sensor value is printed to standard output.

Input Format:
Input is provided via standard input (stdin).

  • One signed integer
  • Data type: int
  • Valid range: implementation-defined signed integer range
  • Represents a temperature sensor reading

Output Format:
The program must print exactly one line:

Temperature=<value>

Where <value> is the integer read from the sensor.

  • No extra spaces
  • No additional text
  • No trailing newline requirements beyond standard output behavior

Example:

Example 1
Input:

25

Output:

Temperature=25 

Example 2
Input:

-10 

Output:

Temperature=-10 

Constraints:

  • The base sensor interface must remain abstract.
  • Every concrete sensor must implement all required interface operations.
  • The main() function must not be modified.
  • No dynamic memory allocation is allowed.
  • No STL containers are allowed.
  • Runtime behavior must be deterministic.
  • The solution must compile without warnings or errors.

 

 

Loading...

Input

25

Expected Output

Temperature=25