I wanted to edit my post but I can't..
I've changed my code up a little bit since I posted, but I am still really stuck on figuring out the time/date issue, it's making everything worse for the math part of things! I do not know what else to do..Please help.
Code:
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main(void)
{
int rentyear, rentmonth, rentday, hour, min;
int returnyear, returnmonth, returnday, returnhour, returnmin;
int totalTimeHour, totalTimeMin;
int cost, costTotal;
printf("Please enter the date and time the bike is rented out\n");
printf("Year (YYYY): ");
scanf("%d", &rentyear);
printf("Month (1 to 12): ");
scanf("%d", &rentmonth);
printf("Day (1 to 31): ");
scanf("%d", &rentday);
printf("Hour (0 to 23): ");
scanf("%d", &hour);
printf("Minutes (0 to 59): ");
scanf("%d", &min);
printf("Please enter the date and time the bike is returned\n");
printf("Year (YYYY): ");
scanf("%d", &returnyear);
printf("Month (1 to 12): ");
scanf("%d", &returnmonth);
printf("Day (1 to 31): ");
scanf("%d", &returnday);
printf("Hour (0 to 23): ");
scanf("%d", &returnhour);
printf("Minutes (0 to 59): ");
scanf("%d", &returnmin);
totalTimeHour = hour - returnhour;
totalTimeMin = min - returnmin;
if(totalTimeHour=<5, costTotal = 5);
else(costTotal = 12, costTotal = costTotal + 0.5);
printf("Duration of Rental: " "%d hours," "%d minutes\n", totalTimeHour, totalTimeMin);
printf("The total price comes to: " "$%d\n", costTotal);
getch(0);
}
I want to calculate and display the total duration and cost of rental time...