You need to think about what you mean by "time." There are two concepts, time points and durations. It makes no sense to add or subtract time points from each other. It makes sense to add and subtract durations (leading to duration), and it makes sense to add and subtract durations with a time point (the result is a time point.
Many time APIs do not do an excellent job of differentiating the two concepts, but the standard C ++ <chrono> works pretty well.
Here is some code that abuses the C tm type to get a couple of durations from the user, adds them together, and then abuses tm again to print the result.
#include <iostream> // cout, cin
bames53
source share