Write a C++ function using the struct and function given. struct time { int hrs; int min; int sec; }; struct time calcul

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write a C++ function using the struct and function given. struct time { int hrs; int min; int sec; }; struct time calcul

Post by answerhappygod »

Write a C++ function using the struct and function given.
struct time
{
int hrs;
int min;
int sec;
};
struct time calculateDifference(struct time t1, struct timet2){
struct time diff;
// Write your code here
return diff;
}
Write A C Function Using The Struct And Function Given Struct Time Int Hrs Int Min Int Sec Struct Time Calcul 1
Write A C Function Using The Struct And Function Given Struct Time Int Hrs Int Min Int Sec Struct Time Calcul 1 (27.76 KiB) Viewed 9 times
Write A C Function Using The Struct And Function Given Struct Time Int Hrs Int Min Int Sec Struct Time Calcul 2
Write A C Function Using The Struct And Function Given Struct Time Int Hrs Int Min Int Sec Struct Time Calcul 2 (33.07 KiB) Viewed 9 times
Sample inputs/outputs Below are some examples: Stop time t1 10:59:59 10:59:59 6:23:54 6:20:51 8:20:51 Start time t2 9:59:59 8:0:0 2:43:12 1:43:12 7:0:0 Time difference 1:0:0 2:59:59 3:40:42 4:37:39 1:20:51
For example, suppose we have initialized the structure variable t1 and t2 with the following values: struct time t1 {10,59,59}; struct time t2 = {9,59,59}; Then the call calculateDifference(t1, t2) should return the following values: {1,0,0} = Note: • The function calculateDifference ( ) takes two parameters of type time in its input parameters and returns the parameter of type time in the output. • Input time will be given in a valid format.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply