Thread: Basic C Programming help!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Registered User
    Join Date
    Feb 2014
    Posts
    10
    Quote Originally Posted by jbc223456 View Post
    If it is by the hour, then you only need minutes in order for display purposes, so you can leave that out of the calculation. You will want to use several if statements to calculate the amount charged. Think about how you would structure that portion (hours <= 5? If so, totalcost = $5, etc for 6-24, and then for 24+). You have to keep in mind that you want to charge $0.50 more per hour if the time exceeds 24 hours. Therefore, you will need a loop. The way you have it now, you will only charge a total of $12.50, even if something was rented for 10 years!
    Thanks, you're right, it will only charge 12.50 for anything over 5 hours... However, I'm more worried about that after, near the finishing point of the program. The problem I'm more worried about now is, I don't know how to calculate the duration.
    How do I go abouts calculating/finding the duration something was rented for, in number of hours? Given the inputs of the year/month/day/hour/min?
    Last edited by convex; 02-14-2014 at 11:25 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Very basic OOP programming in C
    By patishi in forum C Programming
    Replies: 2
    Last Post: 12-20-2013, 03:08 PM
  2. help with my basic c programming
    By chris199236 in forum C Programming
    Replies: 15
    Last Post: 09-25-2012, 09:23 PM
  3. Basic C programming 3
    By vivekgupta in forum C Programming
    Replies: 10
    Last Post: 06-13-2012, 11:22 AM
  4. Basic C programming -1
    By vivekgupta in forum C Programming
    Replies: 29
    Last Post: 06-11-2012, 03:26 PM
  5. basic C-programming Q
    By slyonedoofy in forum C Programming
    Replies: 2
    Last Post: 10-30-2002, 09:54 PM