What is the incorrect action and why does it occur?

Specification: When the object is created, the program below should set the time to HR:MIN:SEC. The ++ operator should increment the minute value. When the fifty-ninth minute is incremented, the HR is incremented and the MIN is reset to 0. Note: Only the class functions are presented here.
```
class Time
{
private:
int hr, min, sec;
public:
Time(int h, int m, int s) { hr = h; min = m; sec = m; }
void operator ++ ();
};
void Time::operator ++ ()
{
min++;
if(min == 59)
{
hr++;
min = 0;
}
}
```


This program contains an inaccurate assignment in the constructor function. The minute value is being assigned to the second variable.

The ++ function contains a logic error. When the time contains the 58th minute, the minute will be incremented and the check in the if statement will then increment the hour and set the minute back to zero. This is incorrect. The check statement should be:

if(min == 60)

Computer Science & Information Technology

You might also like to view...

In the statement cout << *p1;, the * is called the ________________

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

XFL is a default file format for SWF files.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Describe asymmetric encryption.

What will be an ideal response?

Computer Science & Information Technology

At what point in a vulnerability assessment would an attack tree be utilized?

a. vulnerability appraisal. b. risk assessment. c. risk mitigation. d. threat evaluation.

Computer Science & Information Technology