SHARE
TWEET

cplus

Dprogrammed1 Apr 1st, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.     using namespace std;
  3.     struct Time
  4.     {
  5.         int hours;
  6.         int minutes;
  7.         int seconds;
  8.     };
  9.     int toSeconds(Time now);
  10.     int main()
  11.     {
  12.         Time t;
  13.         t.hours = 5;
  14.         t.minutes = 30;
  15.         t.seconds = 45;
  16.         cout << "Total seconds: " << toSeconds(t) << endl;
  17.         return 0;
  18.     }
  19.     int toSeconds(Time now)
  20.     {
  21.         return 3600 * now.hours + 60 * now.minutes + now.seconds;
  22.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top