ExamVeda
Login
Home
Structures and Unions in C plus plus
?

What will be the output of the following C++ code?
#include <iostream>
using namespace std;
struct Time 
{
    int hours;
    int minutes;
    int seconds;
};
int toSeconds(Time now);
int main()
{
    Time t;
    t.hours = 5;
    t.minutes = 30;
    t.seconds = 45;
    cout << "Total seconds: " << toSeconds(t) << endl;
    return 0;
}
int toSeconds(Time now)
{
    return 3600 * now.hours + 60 * now.minutes + now.seconds;
}

Answer & Solution
Correct Answer: Option A
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.