In embedded and firmware systems, counters are frequently used to track events such as interrupts, packets, or errors.
You are given a class named DeviceCounter that maintains an internal counter value. The class already contains:
countYour task is to overload the prefix increment operator (++) so that applying ++counter correctly increments the internal counter value by 1.
In main():
n is read from inputDeviceCounter object is created with an initial count of 0++ operator is applied exactly n timesThe implementation must use prefix operator overloading, not postfix.
Input Specification
nn ≥ 0Output Specification
Print the final counter value in the exact format:
Final count=<value>
Example 1
Input:
3
Output:
Final count=3
Example 2
Input:
5
Output:
Final count=5
Input
3
Expected Output
Final count=3