Here is my code I cannot figure out how to get my dates that I enter to work properly. The user should enter them in looking like this 20000101 year month day.
// This is a late charge calculator
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#define year 365
#define month 30
void main(void)
{
char year1[3],month1[1],day1[1],year2[3],month2[1],day2[1];
int outstand,inteyear,intemonth,inteday,inteyear2,inte month2,inteday2;
int balyear,balmonth,balday;
int peryear,permonth,perday,totaldays,interestowing,to tal;
printf("\n Enter the Date Today(year,month,date):");
scanf("%s %s %s",year1,month1,day1);
inteyear=atoi(year1);
intemonth=atoi(month1);
inteday=atoi(day1);
printf("\n Enter the date it was due(year,month,date):");
scanf("%s %s %s",year2,month2,day2);
inteyear2=atoi(year2);
intemonth2=atoi(month2);
inteday2=atoi(day2);
if(inteyear<inteyear2)
{
printf("\nPlease ensure that the year and date are correct");
}
else
printf("\n Please Enter the outstanding balance:");
scanf("%d",outstand);
balyear=inteyear-inteyear2;
balmonth=intemonth-intemonth2;
balday=inteday-inteday;
totaldays=(balyear*year)+(balmonth*month)+(balday) ;
interestowing=totaldays*.12; //12 percent interest
total=outstand+interestowing;
printf("\nThe total late charge is: %d",interestowing);
printf("\nThe New Total is: %d", total);
}