السلام عليكم ورحمة الله وبركاته
لدي سؤال لم أستطيع فهمه
بحيث مطلوب حله بلغة ++c
هذا هو السؤال :
"Create a class named Time that contains integer fields for hours and minutes.
Store thehours in military time, that is, 0 through 23. Add a function that displays
the fields, usinga colon to separate hours and minutes. (Make sure the minutes
display as two digits. For example, 3 o’clock should display as 3:00, not 3:0.) Add .
another function that takes an argument that represents minutes to add to the
time. The function updates the time based on the number of minutes added. For
example, 12:30 plus 15 is 12:45, 14:50 plus 20 is 15:10, and 23:59 plus 2 is 0:01.
The Time constructor requires an argument for hours. The argument for minutes is
optional; the value defaults to 0 if no argument is supplied. The constructor
ensures that the hours field is not greater than 23 and that the minutes field is not
greater than 59; default to these maximum values if the arguments to the
constructor are out of range. Create a main() function that instantiates an array of
at least four Time objects and demonstrates that they display correctly both before
and after varying amounts of time have been added to them
التعليقات