I've done my best to implement your changes. I do my best to indent properly, but as this is my first time posting code online, I wasn't sure how to go about doing it in that format, I'll try to get it right below.
I've changed my variables, and that has helped a ton.
I rewrote the switch statement, and I'm now getting a 0 as the output, though I believe this is probably becuase I am not calling the function correctly. you see, this is a small part of a large assignment, and I need to use this value later to determine that number of days between to calendar dates in different years. I'll post the rest of my code, feel free to help if you want, but you've already helped a ton.
Code:
#include <stdio.h>
int days, month, year, days_1, month_1, year_1;
int date(int days, int month, int year)/*this is the function that allows the user to input the information they need analyzed into the program*/
{
int days_1, month_1, year_1;
char a, b, a1, b1;
printf("intput a date in the follwing format:\n");
printf("mmddyyyy: in other words the two digit day,two digit month,\n");
printf("and four digit year, with no slashes or heifens anywhere.\n");
scanf("%d%c%d%c%d", &month, &a, &days, &b, &year);
if(month<0 || month>12 || days<0 || days>31 || year<0)
{
printf("data not valid");
}
printf("enter the later date in the same format:\n");
scanf("%d%c%d%c%d", &month_1, &a1, &days_1, &b1, &year_1);
return days, month, year, days_1, month_1, year_1;
}
int daysinmonth(int month) /*there is a problem in this statement, your printf is reading out ridiculous numbers for r, don't forget to ask*/
{
switch(month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
return 31;
case 2:
return 28;
case 4:
case 6:
case 9:
case 11:
return 30;
}
}
/*void leap(int r)
{
if( r%4==0 && r%100 !=0*/
main(void)
{
date(days, month, year);
daysinmonth(month);
printf("days in month=%d", days);
}