Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Please help me with this function

Please help me with this function

Please help me with this function

I have a little  project that the input will read in a quantity of minutes and seconds from the user, and then convert this amount of time to number of years, days, hours, minutes, and seconds.  I am stuck in the function part please help!!!!!!!!!!!


RE: Please help me with this function

first, predetermine the # of minutes in a year, day, hour, minute, (Seconds would be silly)

#define MINS_IN_MIN 1
#define MINS_IN_HOUR 60
#define MINS_IN_DAY 1440

Then compare your input in minutes with MINS_IN_YEAR and if greater, divide by MINS_IN_YEAR. The resulting quoient will be the number of years. Take the remainder and compare with MINS_IN_DAY and if greater, divide by MINS_IN_DAY. The resulting quoient will be the number of days.
And so on....
The seconds (Assuming there are less than 60) will just be passed to the output.

Home Page

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close