i was trying to write a project in C but it is not working
can someone tell me why? and what do i need to change? i am trying to recive the day in week the birthday of a man will be next year after he tell me the date in this year( example 14/11 day 2(monday)
#include<stdio.h> int day,month,day_in_week; void main() { printf("Enter the date of your birthday in 2015 (day,month, day in week):\n"); scanf("%d%d%d",&day,&month,&day_in_week); if(day_in_week<1 || day_in_week>7) { printf("Error date entered"); return; } if(month<1 || month>12) { printf("Error date entered"); return; } switch(month) { case 2: if(day<1 || day>28) { printf("Error date entered"); return; } case 1: case 3:case 5:case 7:case 8:case 10:case 12: if(day<1 || day>31) { printf("Error date entered"); return; } case 4:case 6:case 9:case 11: if(day<1 || day>30) { printf("Error date entered"); return; } } switch(month) { case 1:case 2: day_in_week++; if (day_in_week>7) day_in_week= day_in_week-7; case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12: day_in_week=day_in_week+2; if (day_in_week>7) day_in_week= day_in_week-7; } switch(day_in_week) { case 1: printf("Sunday"); case 2: printf("Monday"); case 3: printf("Tuesday"); case 4: printf("Wednesday"); case 5: printf("Thursday"); case 6: printf("Friday"); case 7: printf("Saturday"); } getch(); return 0; }
breaks?break;after each piece of code incase. Eg.:case 7: puts("Saturday"); break;