Please realize the following functions with operator overloading: input and output time with >> and << use += and -= increase and decrease the time ,e.g.Time& operator+=(const Time&);Time& operator-=(const Time&);
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
【Description】
Write a program to define a class Time, which contains three member variables: hour, minute and second
Please realize the following functions with operator overloading:
-
input and output time with >> and <<
-
use += and -= increase and decrease the time ,e.g.Time& operator+=(const Time&);Time& operator-=(const Time&);
【Input】
-
There are two line, each line is the time of a clock
-
Input format:hour minute second。
【Output】
-
There are two lines.
-
The first line is the output of time1 += (time2) ;
-
The second line is the output of time1 -= time2 ;
-
Output format:hour:minute:second;
-
Please read the
【Input example】
21 10 35
10 15 25
【Output example】
07:26:00
21:10:34
THE SOLUTION YOU SENT ME IS NOT GIVING THE REQUIRED OUTPUTS. PLEASE LOOK AND READ THE INPUT AND THE OUTPUT SAMPLES ABOVE CAREFULLY.
BELOW IS THE SLOTION YOU GAVE ME.
Step by step
Solved in 3 steps with 1 images