Nov 7, 2018 at 7:52pm UTC
Lab 2.11.1 Structure of time or time of structure
Objectives
Familiarize the student with:
declaring structured data types;
declaring structured variables;
referring to a structure's fields.
Scenario
We've shown you how to declare structures intended to store information about dates. Now we encourage you to declare a structure for
handling the time of day with an accuracy of one minute. We think your structure will have two fields, but we don't want to suggest
anything more – all the design decisions are up to you.
After you've done that, declare a variable of the previously declared structure type and write a code asking your user for two values:
hours and minutes. Note: you should use a 24-hour clock, sometimes referred to as "military time".
Check the inputted values carefully – don't accept ideas like 25:71; store the values in your structure variable.
Next, input an int value and assume that this is a number of minutes – let it be the duration of some event.
Your task is to output a time of day (hours and minutes respectively) that will be shown on clocks immediately after our event; try to
show it in the form "HH:MM".
Test your code using the data we've provided.
Example input
11
58
23
Example output
12:21
Example input
23
55
1880
Example output
7:15
Example input
23
55
1441
Example output
23:56
CPA: Programming
Essentials in C++ C++ INSTITUTE- PROGRAM YOUR FUTURE
© 2017 C++ Institute. All rights reserved. Last updated:March 07, 2017 | www.cppinstitute.org Page 1 of 2
Example input
7
45
510
Example output
16:15
Nov 7, 2018 at 8:13pm UTC
I'm sure you do. The problem is that you never do any work yourself.
Nov 7, 2018 at 8:14pm UTC
Show us your initial attempt.
Nov 8, 2018 at 11:50am UTC
On your last thread, I clearly pointed out that, when asking for help, it's helpful to clarify what it is you're having trouble with, and what help you need.
Once you did that, guess what? You got some useful help!
You didn't bother to learn a single thing from that experience, did you?