What will be the output of the following C++ code? [code] #include <iostream> using namespace std; struct Time {

What will be the output of the following C++ code?
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;
    }
A. 19845
B. 20000
C. 15000
D. 19844
 

Tìm kiếm

Back
Top