出现错误[Error] previously used here和[Error] duplicate case value怎么解决

wizardTNT 2023-02-27 20:40:59
#include <stdio.h>
#include <stdlib.h>

int main()
{int a,b,c;
printf("Enter date (mm/dd/yy) :");
scanf("%d/%d/%d",&a,&b,&c);
if (((c%1==0)&&(c>=1))&&((a%1==0)&&(a>=1 && a<=12))&&((b>=1 && b<=31)&&(b%1==0)))
{switch (a)
{case 1:        {switch(b)
case 1 :       printf("Dated this 1st day of January,%d",c);
break;
case 2:        printf("Dated this 2nd day of January,%d",c);
break;
case 3:        printf("Dated this 3rd day of January,%d",c);
break;
case 4:        printf("Dated this 4th day of January,%d",c);
break;
case 5:        printf("Dated this 5th day of January,%d",c);
break;
case 6:        printf("Dated this 6th day of January,%d",c);
break;
case 7:        printf("Dated this 7th day of January,%d",c);
break;
case 8:        printf("Dated this 8th day of January,%d",c);
break;
case 9:        printf("Dated this 9th day of January,%d",c);
break;
case 10:        printf("Dated this 10th day of January,%d",c);
break;
case 11:        printf("Dated this 11th day of January,%d",c);
break;
case 12:        printf("Dated this 12th day of January,%d",c);
break;
case 13:        printf("Dated this 13th day of January,%d",c);
break;
case 14:        printf("Dated this 14th day of January,%d",c);
break;
case 15:        printf("Dated this 15th day of January,%d",c);
break;
case 16:        printf("Dated this 16th day of January,%d",c);
break;
case 17:        printf("Dated this 17th day of January,%d",c);
break;
case 18:        printf("Dated this 18th day of January,%d",c);
break;
case 19:        printf("Dated this 19th day of January,%d",c);
break;
case 20:        printf("Dated this 20th day of January,%d",c);
break;
case 21:        printf("Dated this 21th day of January,%d",c);
break;
case 22:        printf("Dated this 22th day of January,%d",c);
break;
case 23:        printf("Dated this 23th day of January,%d",c);
break;
case 24:        printf("Dated this 24th day of January,%d",c);
break;
case 25:        printf("Dated this 25th day of January,%d",c);
break;
case 26:        printf("Dated this 26th day of January,%d",c);
break;
case 27:        printf("Dated this 27th day of January,%d",c);
break;
case 28:        printf("Dated this 28th day of January,%d",c);
break;
case 29:        printf("Dated this 29th day of January,%d",c);
break;
case 30:        printf("Dated this 30th day of January,%d",c);
break;
case 31:        printf("Dated this 31th day of January,%d",c);
break;
default: printf("Input error!");}
break;
if ((c%4==0&&c%100!=0) || (c%400==0))
    {case 2:{switch(b)
case 1 :       printf("Dated this 1st day of February,%d",c);
break;
case 2:        printf("Dated this 2nd day of February,%d",c);
break;
case 3:        printf("Dated this 3rd day of February,%d",c);
break;
case 4:        printf("Dated this 4th day of February,%d",c);
break;
case 5:        printf("Dated this 5th day of February,%d",c);
break;
case 6:        printf("Dated this 6th day of February,%d",c);
break;
case 7:        printf("Dated this 7th day of February,%d",c);
break;
case 8:        printf("Dated this 8th day of February,%d",c);
break;
case 9:        printf("Dated this 9th day of February,%d",c);
break;
case 10:        printf("Dated this 10th day of February,%d",c);
break;
case 11:        printf("Dated this 11th day of February,%d",c);
break;
case 12:        printf("Dated this 12th day of February,%d",c);
break;
case 13:        printf("Dated this 13th day of February,%d",c);
break;
case 14:        printf("Dated this 14th day of February,%d",c);
break;
case 15:        printf("Dated this 15th day of February,%d",c);
break;
case 16:        printf("Dated this 16th day of February,%d",c);
break;
case 17:        printf("Dated this 17th day of February,%d",c);
break;
case 18:        printf("Dated this 18th day of February,%d",c);
break;
case 19:        printf("Dated this 19th day of February,%d",c);
break;
case 20:        printf("Dated this 20th day of February,%d",c);
break;
case 21:        printf("Dated this 21th day of February,%d",c);
break;
case 22:        printf("Dated this 22th day of February,%d",c);
break;
case 23:        printf("Dated this 23th day of February,%d",c);
break;
case 24:        printf("Dated this 24th day of February,%d",c);
break;
case 25:        printf("Dated this 25th day of February,%d",c);
break;
case 26:        printf("Dated this 26th day of February,%d",c);
break;
case 27:        printf("Dated this 27th day of February,%d",c);
break;
case 28:        printf("Dated this 28th day of February,%d",c);
break;
case 29:        printf("Dated this 29th day of February,%d",c);
break;
default: printf("Input error!");}}
else
    {case 2:{switch(b)
case 1 :       printf("Dated this 1st day of February,%d",c);
break;
case 2:        printf("Dated this 2nd day of February,%d",c);
break;
case 3:        printf("Dated this 3rd day of February,%d",c);
break;
case 4:        printf("Dated this 4th day of February,%d",c);
break;
case 5:        printf("Dated this 5th day of February,%d",c);
break;
case 6:        printf("Dated this 6th day of February,%d",c);
break;
case 7:        printf("Dated this 7th day of February,%d",c);
break;
case 8:        printf("Dated this 8th day of February,%d",c);
break;
case 9:        printf("Dated this 9th day of February,%d",c);
break;
case 10:        printf("Dated this 10th day of February,%d",c);
break;
case 11:        printf("Dated this 11th day of February,%d",c);
break;
case 12:        printf("Dated this 12th day of February,%d",c);
break;
case 13:        printf("Dated this 13th day of February,%d",c);
break;
case 14:        printf("Dated this 14th day of February,%d",c);
break;
case 15:        printf("Dated this 15th day of February,%d",c);
break;
case 16:        printf("Dated this 16th day of February,%d",c);
break;
case 17:        printf("Dated this 17th day of February,%d",c);
break;
case 18:        printf("Dated this 18th day of February,%d",c);
break;
case 19:        printf("Dated this 19th day of February,%d",c);
break;
case 20:        printf("Dated this 20th day of February,%d",c);
break;
case 21:        printf("Dated this 21th day of February,%d",c);
break;
case 22:        printf("Dated this 22th day of February,%d",c);
break;
case 23:        printf("Dated this 23th day of February,%d",c);
break;
case 24:        printf("Dated this 24th day of February,%d",c);
break;
case 25:        printf("Dated this 25th day of February,%d",c);
break;
case 26:        printf("Dated this 26th day of February,%d",c);
break;
case 27:        printf("Dated this 27th day of February,%d",c);
break;
case 28:        printf("Dated this 28th day of February,%d",c);
break;
case 29:        printf("Dated this 29th day of February,%d",c);
break;
default: printf("Input error!");}}
break;
case 3:{switch(b)
case 1 :       printf("Dated this 1st day of March,%d",c);
break;
case 2:        printf("Dated this 2nd day of March,%d",c);
break;
case 3:        printf("Dated this 3rd day of March,%d",c);
break;
case 4:        printf("Dated this 4th day of March,%d",c);
break;
case 5:        printf("Dated this 5th day of March,%d",c);
break;
case 6:        printf("Dated this 6th day of March,%d",c);
break;
case 7:        printf("Dated this 7th day of March,%d",c);
break;
case 8:        printf("Dated this 8th day of March,%d",c);
break;
case 9:        printf("Dated this 9th day of March,%d",c);
break;
case 10:        printf("Dated this 10th day of March,%d",c);
break;
case 11:        printf("Dated this 11th day of March,%d",c);
break;
case 12:        printf("Dated this 12th day of March,%d",c);
break;
case 13:        printf("Dated this 13th day of March,%d",c);
break;
case 14:        printf("Dated this 14th day of March,%d",c);
break;
case 15:        printf("Dated this 15th day of March,%d",c);
break;
case 16:        printf("Dated this 16th day of March,%d",c);
break;
case 17:        printf("Dated this 17th day of March,%d",c);
break;
case 18:        printf("Dated this 18th day of March,%d",c);
break;
case 19:        printf("Dated this 19th day of March,%d",c);
break;
case 20:        printf("Dated this 20th day of March,%d",c);
break;
case 21:        printf("Dated this 21th day of March,%d",c);
break;
case 22:        printf("Dated this 22th day of March,%d",c);
break;
case 23:        printf("Dated this 23th day of March,%d",c);
break;
case 24:        printf("Dated this 24th day of March,%d",c);
break;
case 25:        printf("Dated this 25th day of March,%d",c);
break;
case 26:        printf("Dated this 26th day of March,%d",c);
break;
case 27:        printf("Dated this 27th day of March,%d",c);
break;
case 28:        printf("Dated this 28th day of March,%d",c);
break;
case 29:        printf("Dated this 29th day of March,%d",c);
break;
case 30:        printf("Dated this 30th day of March,%d",c);
break;
case 31:        printf("Dated this 31th day of March,%d",c);
break;
default: printf("Input error!");}
break;
case 4:{switch(b)
case 1 :       printf("Dated this 1st day of April,%d",c);
break;
case 2:        printf("Dated this 2nd day of April,%d",c);
break;
case 3:        printf("Dated this 3rd day of April,%d",c);
break;
case 4:        printf("Dated this 4th day of April,%d",c);
break;
case 5:        printf("Dated this 5th day of April,%d",c);
break;
case 6:        printf("Dated this 6th day of April,%d",c);
break;
case 7:        printf("Dated this 7th day of April,%d",c);
break;
case 8:        printf("Dated this 8th day of April,%d",c);
break;
case 9:        printf("Dated this 9th day of April,%d",c);
break;
case 10:        printf("Dated this 10th day of April,%d",c);
break;
case 11:        printf("Dated this 11th day of April,%d",c);
break;
case 12:        printf("Dated this 12th day of April,%d",c);
break;
case 13:        printf("Dated this 13th day of April,%d",c);
break;
case 14:        printf("Dated this 14th day of April,%d",c);
break;
case 15:        printf("Dated this 15th day of April,%d",c);
break;
case 16:        printf("Dated this 16th day of April,%d",c);
break;
case 17:        printf("Dated this 17th day of April,%d",c);
break;
case 18:        printf("Dated this 18th day of April,%d",c);
break;
case 19:        printf("Dated this 19th day of April,%d",c);
break;
case 20:        printf("Dated this 20th day of April,%d",c);
break;
case 21:        printf("Dated this 21th day of April,%d",c);
break;
case 22:        printf("Dated this 22th day of April,%d",c);
break;
case 23:        printf("Dated this 23th day of April,%d",c);
break;
case 24:        printf("Dated this 24th day of April,%d",c);
break;
case 25:        printf("Dated this 25th day of April,%d",c);
break;
case 26:        printf("Dated this 26th day of April,%d",c);
break;
case 27:        printf("Dated this 27th day of April,%d",c);
break;
case 28:        printf("Dated this 28th day of April,%d",c);
break;
case 29:        printf("Dated this 29th day of April,%d",c);
break;
case 30:        printf("Dated this 30th day of April,%d",c);
break;
default: printf("Input error!");}
break;
case 5:{switch(b)
case 1 :       printf("Dated this 1st day of May,%d",c);
break;
case 2:        printf("Dated this 2nd day of May,%d",c);
break;
case 3:        printf("Dated this 3rd day of May,%d",c);
break;
case 4:        printf("Dated this 4th day of May,%d",c);
break;
case 5:        printf("Dated this 5th day of May,%d",c);
break;
case 6:        printf("Dated this 6th day of May,%d",c);
break;
case 7:        printf("Dated this 7th day of May,%d",c);
break;
case 8:        printf("Dated this 8th day of May,%d",c);
break;
case 9:        printf("Dated this 9th day of May,%d",c);
break;
case 10:        printf("Dated this 10th day of May,%d",c);
break;
case 11:        printf("Dated this 11th day of May,%d",c);
break;
case 12:        printf("Dated this 12th day of May,%d",c);
break;
case 13:        printf("Dated this 13th day of May,%d",c);
break;
case 14:        printf("Dated this 14th day of May,%d",c);
break;
case 15:        printf("Dated this 15th day of May,%d",c);
break;
case 16:        printf("Dated this 16th day of May,%d",c);
break;
case 17:        printf("Dated this 17th day of May,%d",c);
break;
case 18:        printf("Dated this 18th day of May,%d",c);
break;
case 19:        printf("Dated this 19th day of May,%d",c);
break;
case 20:        printf("Dated this 20th day of May,%d",c);
break;
case 21:        printf("Dated this 21th day of May,%d",c);
break;
case 22:        printf("Dated this 22th day of May,%d",c);
break;
case 23:        printf("Dated this 23th day of May,%d",c);
break;
case 24:        printf("Dated this 24th day of May,%d",c);
break;
case 25:        printf("Dated this 25th day of May,%d",c);
break;
case 26:        printf("Dated this 26th day of May,%d",c);
break;
case 27:        printf("Dated this 27th day of May,%d",c);
break;
case 28:        printf("Dated this 28th day of May,%d",c);
break;
case 29:        printf("Dated this 29th day of May,%d",c);
break;
case 30:        printf("Dated this 30th day of May,%d",c);
break;
case 31:        printf("Dated this 31th day of May,%d",c);
break;
default: printf("Input error!");}
break;
case 6:{switch(b)
case 1 :       printf("Dated this 1st day of June,%d",c);
break;
case 2:        printf("Dated this 2nd day of June,%d",c);
break;
case 3:        printf("Dated this 3rd day of June,%d",c);
break;
case 4:        printf("Dated this 4th day of June,%d",c);
break;
case 5:        printf("Dated this 5th day of June,%d",c);
break;
case 6:        printf("Dated this 6th day of June,%d",c);
break;
case 7:        printf("Dated this 7th day of June,%d",c);
break;
case 8:        printf("Dated this 8th day of June,%d",c);
break;
case 9:        printf("Dated this 9th day of June,%d",c);
break;
case 10:        printf("Dated this 10th day of June,%d",c);
break;
case 11:        printf("Dated this 11th day of June,%d",c);
break;
case 12:        printf("Dated this 12th day of June,%d",c);
break;
case 13:        printf("Dated this 13th day of June,%d",c);
break;
case 14:        printf("Dated this 14th day of June,%d",c);
break;
case 15:        printf("Dated this 15th day of June,%d",c);
break;
case 16:        printf("Dated this 16th day of June,%d",c);
break;
case 17:        printf("Dated this 17th day of June,%d",c);
break;
case 18:        printf("Dated this 18th day of June,%d",c);
break;
case 19:        printf("Dated this 19th day of June,%d",c);
break;
case 20:        printf("Dated this 20th day of June,%d",c);
break;
case 21:        printf("Dated this 21th day of June,%d",c);
break;
case 22:        printf("Dated this 22th day of June,%d",c);
break;
case 23:        printf("Dated this 23th day of June,%d",c);
break;
case 24:        printf("Dated this 24th day of June,%d",c);
break;
case 25:        printf("Dated this 25th day of June,%d",c);
break;
case 26:        printf("Dated this 26th day of June,%d",c);
break;
case 27:        printf("Dated this 27th day of June,%d",c);
break;
case 28:        printf("Dated this 28th day of June,%d",c);
break;
case 29:        printf("Dated this 29th day of June,%d",c);
break;
case 30:        printf("Dated this 30th day of June,%d",c);
break;
default: printf("Input error!");}
break;
case 7:
    {switch(b)
case 1 :       printf("Dated this 1st day of July,%d",c);
break;
case 2:        printf("Dated this 2nd day of July,%d",c);
break;
case 3:        printf("Dated this 3rd day of July,%d",c);
break;
case 4:        printf("Dated this 4th day of July,%d",c);
break;
case 5:        printf("Dated this 5th day of July,%d",c);
break;
case 6:        printf("Dated this 6th day of July,%d",c);
break;
case 7:        printf("Dated this 7th day of July,%d",c);
break;
case 8:        printf("Dated this 8th day of July,%d",c);
break;
case 9:        printf("Dated this 9th day of July,%d",c);
break;
case 10:        printf("Dated this 10th day of July,%d",c);
break;
case 11:        printf("Dated this 11th day of July,%d",c);
break;
case 12:        printf("Dated this 12th day of July,%d",c);
break;
case 13:        printf("Dated this 13th day of July,%d",c);
break;
case 14:        printf("Dated this 14th day of July,%d",c);
break;
case 15:        printf("Dated this 15th day of July,%d",c);
break;
case 16:        printf("Dated this 16th day of July,%d",c);
break;
case 17:        printf("Dated this 17th day of July,%d",c);
break;
case 18:        printf("Dated this 18th day of July,%d",c);
break;
case 19:        printf("Dated this 19th day of July,%d",c);
break;
case 20:        printf("Dated this 20th day of July,%d",c);
break;
case 21:        printf("Dated this 21th day of July,%d",c);
break;
case 22:        printf("Dated this 22th day of July,%d",c);
break;
case 23:        printf("Dated this 23th day of July,%d",c);
break;
case 24:        printf("Dated this 24th day of July,%d",c);
break;
case 25:        printf("Dated this 25th day of July,%d",c);
break;
case 26:        printf("Dated this 26th day of July,%d",c);
break;
case 27:        printf("Dated this 27th day of July,%d",c);
break;
case 28:        printf("Dated this 28th day of July,%d",c);
break;
case 29:        printf("Dated this 29th day of July,%d",c);
break;
case 30:        printf("Dated this 30th day of July,%d",c);
break;
case 31:        printf("Dated this 31th day of July,%d",c);
break;
default: printf("Input error!");}
break;
case 8:
    {switch(b)
case 1 :       printf("Dated this 1st day of August,%d",c);
break;
case 2:        printf("Dated this 2nd day of August,%d",c);
break;
case 3:        printf("Dated this 3rd day of August,%d",c);
break;
case 4:        printf("Dated this 4th day of August,%d",c);
break;
case 5:        printf("Dated this 5th day of August,%d",c);
break;
case 6:        printf("Dated this 6th day of August,%d",c);
break;
case 7:        printf("Dated this 7th day of August,%d",c);
break;
case 8:        printf("Dated this 8th day of August,%d",c);
break;
case 9:        printf("Dated this 9th day of August,%d",c);
break;
case 10:        printf("Dated this 10th day of August,%d",c);
break;
case 11:        printf("Dated this 11th day of August,%d",c);
break;
case 12:        printf("Dated this 12th day of August,%d",c);
break;
case 13:        printf("Dated this 13th day of August,%d",c);
break;
case 14:        printf("Dated this 14th day of August,%d",c);
break;
case 15:        printf("Dated this 15th day of August,%d",c);
break;
case 16:        printf("Dated this 16th day of August,%d",c);
break;
case 17:        printf("Dated this 17th day of August,%d",c);
break;
case 18:        printf("Dated this 18th day of August,%d",c);
break;
case 19:        printf("Dated this 19th day of August,%d",c);
break;
case 20:        printf("Dated this 20th day of August,%d",c);
break;
case 21:        printf("Dated this 21th day of August,%d",c);
break;
case 22:        printf("Dated this 22th day of August,%d",c);
break;
case 23:        printf("Dated this 23th day of August,%d",c);
break;
case 24:        printf("Dated this 24th day of August,%d",c);
break;
case 25:        printf("Dated this 25th day of August,%d",c);
break;
case 26:        printf("Dated this 26th day of August,%d",c);
break;
case 27:        printf("Dated this 27th day of August,%d",c);
break;
case 28:        printf("Dated this 28th day of August,%d",c);
break;
case 29:        printf("Dated this 29th day of August,%d",c);
break;
case 30:        printf("Dated this 30th day of August,%d",c);
break;
case 31:        printf("Dated this 31th day of August,%d",c);
break;
default: printf("Input error!");}
break;
case 9:
    {switch(b)
case 1 :       printf("Dated this 1st day of September,%d",c);
break;
case 2:        printf("Dated this 2nd day of September,%d",c);
break;
case 3:        printf("Dated this 3rd day of September,%d",c);
break;
case 4:        printf("Dated this 4th day of September,%d",c);
break;
case 5:        printf("Dated this 5th day of September,%d",c);
break;
case 6:        printf("Dated this 6th day of September,%d",c);
break;
case 7:        printf("Dated this 7th day of September,%d",c);
break;
case 8:        printf("Dated this 8th day of September,%d",c);
break;
case 9:        printf("Dated this 9th day of September,%d",c);
break;
case 10:        printf("Dated this 10th day of September,%d",c);
break;
case 11:        printf("Dated this 11th day of September,%d",c);
break;
case 12:        printf("Dated this 12th day of September,%d",c);
break;
case 13:        printf("Dated this 13th day of September,%d",c);
break;
case 14:        printf("Dated this 14th day of September,%d",c);
break;
case 15:        printf("Dated this 15th day of September,%d",c);
break;
case 16:        printf("Dated this 16th day of September,%d",c);
break;
case 17:        printf("Dated this 17th day of September,%d",c);
break;
case 18:        printf("Dated this 18th day of September,%d",c);
break;
case 19:        printf("Dated this 19th day of September,%d",c);
break;
case 20:        printf("Dated this 20th day of September,%d",c);
break;
case 21:        printf("Dated this 21th day of September,%d",c);
break;
case 22:        printf("Dated this 22th day of September,%d",c);
break;
case 23:        printf("Dated this 23th day of September,%d",c);
break;
case 24:        printf("Dated this 24th day of September,%d",c);
break;
case 25:        printf("Dated this 25th day of September,%d",c);
break;
case 26:        printf("Dated this 26th day of September,%d",c);
break;
case 27:        printf("Dated this 27th day of September,%d",c);
break;
case 28:        printf("Dated this 28th day of September,%d",c);
break;
case 29:        printf("Dated this 29th day of September,%d",c);
break;
case 30:        printf("Dated this 30th day of September,%d",c);
break;
default: printf("Input error!");}
break;
case 10:
    {switch(b)
case 1 :       printf("Dated this 1st day of October,%d",c);
break;
case 2:        printf("Dated this 2nd day of October,%d",c);
break;
case 3:        printf("Dated this 3rd day of October,%d",c);
break;
case 4:        printf("Dated this 4th day of October,%d",c);
break;
case 5:        printf("Dated this 5th day of October,%d",c);
break;
case 6:        printf("Dated this 6th day of October,%d",c);
break;
case 7:        printf("Dated this 7th day of October,%d",c);
break;
case 8:        printf("Dated this 8th day of October,%d",c);
break;
case 9:        printf("Dated this 9th day of October,%d",c);
break;
case 10:        printf("Dated this 10th day of October,%d",c);
break;
case 11:        printf("Dated this 11th day of October,%d",c);
break;
case 12:        printf("Dated this 12th day of October,%d",c);
break;
case 13:        printf("Dated this 13th day of October,%d",c);
break;
case 14:        printf("Dated this 14th day of October,%d",c);
break;
case 15:        printf("Dated this 15th day of October,%d",c);
break;
case 16:        printf("Dated this 16th day of October,%d",c);
break;
case 17:        printf("Dated this 17th day of October,%d",c);
break;
case 18:        printf("Dated this 18th day of October,%d",c);
break;
case 19:        printf("Dated this 19th day of October,%d",c);
break;
case 20:        printf("Dated this 20th day of October,%d",c);
break;
case 21:        printf("Dated this 21th day of October,%d",c);
break;
case 22:        printf("Dated this 22th day of October,%d",c);
break;
case 23:        printf("Dated this 23th day of October,%d",c);
break;
case 24:        printf("Dated this 24th day of October,%d",c);
break;
case 25:        printf("Dated this 25th day of October,%d",c);
break;
case 26:        printf("Dated this 26th day of October,%d",c);
break;
case 27:        printf("Dated this 27th day of October,%d",c);
break;
case 28:        printf("Dated this 28th day of October,%d",c);
break;
case 29:        printf("Dated this 29th day of October,%d",c);
break;
case 30:        printf("Dated this 30th day of October,%d",c);
break;
case 31:        printf("Dated this 31th day of October,%d",c);
break;
default: printf("Input error!");}
break;
case 11:
    {switch(b)
case 1 :       printf("Dated this 1st day of November,%d",c);
break;
case 2:        printf("Dated this 2nd day of November,%d",c);
break;
case 3:        printf("Dated this 3rd day of November,%d",c);
break;
case 4:        printf("Dated this 4th day of November,%d",c);
break;
case 5:        printf("Dated this 5th day of November,%d",c);
break;
case 6:        printf("Dated this 6th day of November,%d",c);
break;
case 7:        printf("Dated this 7th day of November,%d",c);
break;
case 8:        printf("Dated this 8th day of November,%d",c);
break;
case 9:        printf("Dated this 9th day of November,%d",c);
break;
case 10:        printf("Dated this 10th day of November,%d",c);
break;
case 11:        printf("Dated this 11th day of November,%d",c);
break;
case 12:        printf("Dated this 12th day of November,%d",c);
break;
case 13:        printf("Dated this 13th day of November,%d",c);
break;
case 14:        printf("Dated this 14th day of November,%d",c);
break;
case 15:        printf("Dated this 15th day of November,%d",c);
break;
case 16:        printf("Dated this 16th day of November,%d",c);
break;
case 17:        printf("Dated this 17th day of November,%d",c);
break;
case 18:        printf("Dated this 18th day of November,%d",c);
break;
case 19:        printf("Dated this 19th day of November,%d",c);
break;
case 20:        printf("Dated this 20th day of November,%d",c);
break;
case 21:        printf("Dated this 21th day of November,%d",c);
break;
case 22:        printf("Dated this 22th day of November,%d",c);
break;
case 23:        printf("Dated this 23th day of November,%d",c);
break;
case 24:        printf("Dated this 24th day of November,%d",c);
break;
case 25:        printf("Dated this 25th day of November,%d",c);
break;
case 26:        printf("Dated this 26th day of November,%d",c);
break;
case 27:        printf("Dated this 27th day of November,%d",c);
break;
case 28:        printf("Dated this 28th day of November,%d",c);
break;
case 29:        printf("Dated this 29th day of November,%d",c);
break;
case 30:        printf("Dated this 30th day of November,%d",c);
break;
default: printf("Input error!");}
break;
case 12:
    {switch(b)
case 1 :       printf("Dated this 1st day of December,%d",c);
break;
case 2:        printf("Dated this 2nd day of December,%d",c);
break;
case 3:        printf("Dated this 3rd day of December,%d",c);
break;
case 4:        printf("Dated this 4th day of December,%d",c);
break;
case 5:        printf("Dated this 5th day of December,%d",c);
break;
case 6:        printf("Dated this 6th day of December,%d",c);
break;
case 7:        printf("Dated this 7th day of December,%d",c);
break;
case 8:        printf("Dated this 8th day of December,%d",c);
break;
case 9:        printf("Dated this 9th day of December,%d",c);
break;
case 10:        printf("Dated this 10th day of December,%d",c);
break;
case 11:        printf("Dated this 11th day of December,%d",c);
break;
case 12:        printf("Dated this 12th day of December,%d",c);
break;
case 13:        printf("Dated this 13th day of December,%d",c);
break;
case 14:        printf("Dated this 14th day of December,%d",c);
break;
case 15:        printf("Dated this 15th day of December,%d",c);
break;
case 16:        printf("Dated this 16th day of December,%d",c);
break;
case 17:        printf("Dated this 17th day of December,%d",c);
break;
case 18:        printf("Dated this 18th day of December,%d",c);
break;
case 19:        printf("Dated this 19th day of December,%d",c);
break;
case 20:        printf("Dated this 20th day of December,%d",c);
break;
case 21:        printf("Dated this 21th day of December,%d",c);
break;
case 22:        printf("Dated this 22th day of December,%d",c);
break;
case 23:        printf("Dated this 23th day of December,%d",c);
break;
case 24:        printf("Dated this 24th day of December,%d",c);
break;
case 25:        printf("Dated this 25th day of December,%d",c);
break;
case 26:        printf("Dated this 26th day of December,%d",c);
break;
case 27:        printf("Dated this 27th day of December,%d",c);
break;
case 28:        printf("Dated this 28th day of December,%d",c);
break;
case 29:        printf("Dated this 29th day of December,%d",c);
break;
case 30:        printf("Dated this 30th day of December,%d",c);
break;
case 31:        printf("Dated this 31th day of December,%d",c);
break;
default: printf("Input error!");}
break;
default: printf("Input error!");}}
else
{printf("Input error!\n");}
    return 0;
}

 

...全文
906 8 打赏 收藏 举报
写回复
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 03-02
  • 打赏
  • 举报
回复 1
//接上贴
month == "11") {
        if (dayOfMonth > 30) {
            cout << "Invalid day for this month\n";
            return 1;
        }
    }

    // Print the output string
    cout << "Dated this " << day << daySuffix << " day of " << monthName << ", 
//……下面请自行补足 (^_^)
赵4老师 03-02
  • 打赏
  • 举报
回复 1

#include <iostream>
#include <string>
using namespace std;

int main() {
    string date;
    cout << "Enter date (mm/dd/yy): ";
    cin >> date;

    // Parse the month, day, and year from the input string
    string month = date.substr(0, 2);
    string day = date.substr(3, 2);
    string year = date.substr(6, 2);

    // Convert the month to its corresponding string name
    string monthName;
    if (month == "01") { monthName = "January"; }
    else if (month == "02") { monthName = "February"; }
    else if (month == "03") { monthName = "March"; }
    else if (month == "04") { monthName = "April"; }
    else if (month == "05") { monthName = "May"; }
    else if (month == "06") { monthName = "June"; }
    else if (month == "07") { monthName = "July"; }
    else if (month == "08") { monthName = "August"; }
    else if (month == "09") { monthName = "September"; }
    else if (month == "10") { monthName = "October"; }
    else if (month == "11") { monthName = "November"; }
    else if (month == "12") { monthName = "December"; }
    else { cout << "Invalid month\n"; return 1; }

    // Determine the day suffix (e.g. "st", "nd", "rd", or "th")
    string daySuffix;
    if (day == "01" || day == "21" || day == "31") { daySuffix = "st"; }
    else if (day == "02" || day == "22") { daySuffix = "nd"; }
    else if (day == "03" || day == "23") { daySuffix = "rd"; }
    else { daySuffix = "th"; }

    // Check if the year is a leap year
    int yearNum = stoi(year);
    bool isLeapYear = (yearNum % 4 == 0 && yearNum % 100 != 0) || (yearNum % 400 == 0);

    // Validate the day of the month
    int dayOfMonth = stoi(day);
    if (dayOfMonth < 1 || dayOfMonth > 31) {
        cout << "Invalid day\n";
        return 1;
    } else if (month == "02") {
        if (dayOfMonth > 29 || (dayOfMonth == 29 && !isLeapYear)) {
            cout << "Invalid day for February in this year\n";
            return 1;
        }
    } else if (month == "04" || month == "06" || month == "09" ||
//未完待续
赵4老师 02-28
  • 打赏
  • 举报
回复
 //接上贴
  case 6:
   switch(d){
   case  1:printf("Dated this  1st day of June,%d",y);break;
   case  2:printf("Dated this  2nd day of June,%d",y);break;
   case  3:printf("Dated this  3rd day of June,%d",y);break;
   case  4:printf("Dated this  4th day of June,%d",y);break;
   case  5:printf("Dated this  5th day of June,%d",y);break;
   case  6:printf("Dated this  6th day of June,%d",y);break;
   case  7:printf("Dated this  7th day of June,%d",y);break;
   case  8:printf("Dated this  8th day of June,%d",y);break;
   case  9:printf("Dated this  9th day of June,%d",y);break;
   case 10:printf("Dated this 10th day of June,%d",y);break;
   case 11:printf("Dated this 11th day of June,%d",y);break;
   case 12:printf("Dated this 12th day of June,%d",y);break;
   case 13:printf("Dated this 13th day of June,%d",y);break;
   case 14:printf("Dated this 14th day of June,%d",y);break;
   case 15:printf("Dated this 15th day of June,%d",y);break;
   case 16:printf("Dated this 16th day of June,%d",y);break;
   case 17:printf("Dated this 17th day of June,%d",y);break;
   case 18:printf("Dated this 18th day of June,%d",y);break;
   case 19:printf("Dated this 19th day of June,%d",y);break;
   case 20:printf("Dated this 20th day of June,%d",y);break;
   case 21:printf("Dated this 21th day of June,%d",y);break;
   case 22:printf("Dated this 22th day of June,%d",y);break;
   case 23:printf("Dated this 23th day of June,%d",y);break;
   case 24:printf("Dated this 24th day of June,%d",y);break;
   case 25:printf("Dated this 25th day of June,%d",y);break;
   case 26:printf("Dated this 26th day of June,%d",y);break;
   case 27:printf("Dated this 27th day of June,%d",y);break;
   case 28:printf("Dated this 28th day of June,%d",y);break;
   case 29:printf("Dated this 29th day of June,%d",y);break;
   case 30:printf("Dated this 30th day of June,%d",y);break;
   default:printf("Input error!");
   }
  break;
  case 7:
   switch(d){
   case  1:printf("Dated this  1st day of July,%d",y);break;
   case  2:printf("Dated this  2nd day of July,%d",y);break;
   case  3:printf("Dated this  3rd day of July,%d",y);break;
   case  4:printf("Dated this  4th day of July,%d",y);break;
   case  5:printf("Dated this  5th day of July,%d",y);break;
   case  6:printf("Dated this  6th day of July,%d",y);break;
   case  7:printf("Dated this  7th day of July,%d",y);break;
   case  8:printf("Dated this  8th day of July,%d",y);break;
   case  9:printf("Dated this  9th day of July,%d",y);break;
   case 10:printf("Dated this 10th day of July,%d",y);break;
   case 11:printf("Dated this 11th day of July,%d",y);break;
   case 12:printf("Dated this 12th day of July,%d",y);break;
   case 13:printf("Dated this 13th day of July,%d",y);break;
   case 14:printf("Dated this 14th day of July,%d",y);break;
   case 15:printf("Dated this 15th day of July,%d",y);break;
   case 16:printf("Dated this 16th day of July,%d",y);break;
   case 17:printf("Dated this 17th day of July,%d",y);break;
   case 18:printf("Dated this 18th day of July,%d",y);break;
   case 19:printf("Dated this 19th day of July,%d",y);break;
   case 20:printf("Dated this 20th day of July,%d",y);break;
   case 21:printf("Dated this 21th day of July,%d",y);break;
   case 22:printf("Dated this 22th day of July,%d",y);break;
   case 23:printf("Dated this 23th day of July,%d",y);break;
   case 24:printf("Dated this 24th day of July,%d",y);break;
   case 25:printf("Dated this 25th day of July,%d",y);break;
   case 26:printf("Dated this 26th day of July,%d",y);break;
   case 27:printf("Dated this 27th day of July,%d",y);break;
   case 28:printf("Dated this 28th day of July,%d",y);break;
   case 29:printf("Dated this 29th day of July,%d",y);break;
   case 30:printf("Dated this 30th day of July,%d",y);break;
   case 31:printf("Dated this 31th day of July,%d",y);break;
   default:printf("Input error!");
   }
  break;
  case 8:
   switch(d){
   case  1:printf("Dated this  1st day of August,%d",y);break;
   case  2:printf("Dated this  2nd day of August,%d",y);break;
   case  3:printf("Dated this  3rd day of August,%d",y);break;
   case  4:printf("Dated this  4th day of August,%d",y);break;
   case  5:printf("Dated this  5th day of August,%d",y);break;
   case  6:printf("Dated this  6th day of August,%d",y);break;
   case  7:printf("Dated this  7th day of August,%d",y);break;
   case  8:printf("Dated this  8th day of August,%d",y);break;
   case  9:printf("Dated this  9th day of August,%d",y);break;
   case 10:printf("Dated this 10th day of August,%d",y);break;
   case 11:printf("Dated this 11th day of August,%d",y);break;
   case 12:printf("Dated this 12th day of August,%d",y);break;
   case 13:printf("Dated this 13th day of August,%d",y);break;
   case 14:printf("Dated this 14th day of August,%d",y);break;
   case 15:printf("Dated this 15th day of August,%d",y);break;
   case 16:printf("Dated this 16th day of August,%d",y);break;
   case 17:printf("Dated this 17th day of August,%d",y);break;
   case 18:printf("Dated this 18th day of August,%d",y);break;
   case 19:printf("Dated this 19th day of August,%d",y);break;
   case 20:printf("Dated this 20th day of August,%d",y);break;
   case 21:printf("Dated this 21th day of August,%d",y);break;
   case 22:printf("Dated this 22th day of August,%d",y);break;
   case 23:printf("Dated this 23th day of August,%d",y);break;
   case 24:printf("Dated this 24th day of August,%d",y);break;
   case 25:printf("Dated this 25th day of August,%d",y);break;
   case 26:printf("Dated this 26th day of August,%d",y);break;
   case 27:printf("Dated this 27th day of August,%d",y);break;
   case 28:printf("Dated this 28th day of August,%d",y);break;
   case 29:printf("Dated this 29th day of August,%d",y);break;
   case 30:printf("Dated this 30th day of August,%d",y);break;
   case 31:printf("Dated this 31th day of August,%d",y);break;
   default:printf("Input error!");
   }
  break;
  case 9:
   switch(d){
   case  1:printf("Dated this  1st day of September,%d",y);break;
   case  2:printf("Dated this  2nd day of September,%d",y);break;
   case  3:printf("Dated this  3rd day of September,%d",y);break;
   case  4:printf("Dated this  4th day of September,%d",y);break;
   case  5:printf("Dated this  5th day of September,%d",y);break;
   case  6:printf("Dated this  6th day of September,%d",y);break;
   case  7:printf("Dated this  7th day of September,%d",y);break;
   case  8:printf("Dated this  8th day of September,%d",y);break;
   case  9:printf("Dated this  9th day of September,%d",y);break;
   case 10:printf("Dated this 10th day of September,%d",y);break;
   case 11:printf("Dated this 11th day of September,%d",y);break;
   case 12:printf("Dated this 12th day of September,%d",y);break;
   case 13:printf("Dated this 13th day of September,%d",y);break;
   case 14:printf("Dated this 14th day of September,%d",y);break;
   case 15:printf("Dated this 15th day of September,%d",y);break;
   case 16:printf("Dated this 16th day of September,%d",y);break;
   case 17:printf("Dated this 17th day of September,%d",y);break;
   case 18:printf("Dated this 18th day of September,%d",y);break;
   case 19:printf("Dated this 19th day of September,%d",y);break;
   case 20:printf("Dated this 20th day of September,%d",y);break;
   case 21:printf("Dated this 21th day of September,%d",y);break;
   case 22:printf("Dated this 22th day of September,%d",y);break;
   case 23:printf("Dated this 23th day of September,%d",y);break;
   case 24:printf("Dated this 24th day of September,%d",y);break;
   case 25:printf("Dated this 25th day of September,%d",y);break;
   case 26:printf("Dated this 26th day of September,%d",y);break;
   case 27:printf("Dated this 27th day of September,%d",y);break;
   case 28:printf("Dated this 28th day of September,%d",y);break;
   case 29:printf("Dated this 29th day of September,%d",y);break;
   case 30:printf("Dated this 30th day of September,%d",y);break;
   default:printf("Input error!");
   }
  break;
  case 10:
   switch(d){
   case  1:printf("Dated this  1st day of October,%d",y);break;
   case  2:printf("Dated this  2nd day of October,%d",y);break;
   case  3:printf("Dated this  3rd day of October,%d",y);break;
   case  4:printf("Dated this  4th day of October,%d",y);break;
   case  5:printf("Dated this  5th day of October,%d",y);break;
   case  6:printf("Dated this  6th day of October,%d",y);break;
   case  7:printf("Dated this  7th day of October,%d",y);break;
   case  8:printf("Dated this  8th day of October,%d",y);break;
   case  9:printf("Dated this  9th day of October,%d",y);break;
   case 10:printf("Dated this 10th day of October,%d",y);break;
   case 11:printf("Dated this 11th day of October,%d",y);break;
   case 12:printf("Dated this 12th day of October,%d",y);break;
   case 13:printf("Dated this 13th day of October,%d",y);break;
   case 14:printf("Dated this 14th day of October,%d",y);break;
   case 15:printf("Dated this 15th day of October,%d",y);break;
   case 16:printf("Dated this 16th day of October,%d",y);break;
   case 17:printf("Dated this 17th day of October,%d",y);break;
   case 18:printf("Dated this 18th day of October,%d",y);break;
   case 19:printf("Dated this 19th day of October,%d",y);break;
   case 20:printf("Dated this 20th day of October,%d",y);break;
   case 21:printf("Dated this 21th day of October,%d",y);break;
   case 22:printf("Dated this 22th day of October,%d",y);break;
   case 23:printf("Dated this 23th day of October,%d",y);break;
   case 24:printf("Dated this 24th day of October,%d",y);break;
   case 25:printf("Dated this 25th day of October,%d",y);break;
   case 26:printf("Dated this 26th day of October,%d",y);break;
   case 27:printf("Dated this 27th day of October,%d",y);break;
   case 28:printf("Dated this 28th day of October,%d",y);break;
   case 29:printf("Dated this 29th day of October,%d",y);break;
   case 30:printf("Dated this 30th day of October,%d",y);break;
   case 31:printf("Dated this 31th day of October,%d",y);break;
   default:printf("Input error!");
   }
  break;
  case 11:
   switch(d){
   case  1:printf("Dated this  1st day of November,%d",y);break;
   case  2:printf("Dated this  2nd day of November,%d",y);break;
   case  3:printf("Dated this  3rd day of November,%d",y);break;
   case  4:printf("Dated this  4th day of November,%d",y);break;
   case  5:printf("Dated this  5th day of November,%d",y);break;
   case  6:printf("Dated this  6th day of November,%d",y);break;
   case  7:printf("Dated this  7th day of November,%d",y);break;
   case  8:printf("Dated this  8th day of November,%d",y);break;
   case  9:printf("Dated this  9th day of November,%d",y);break;
   case 10:printf("Dated this 10th day of November,%d",y);break;
   case 11:printf("Dated this 11th day of November,%d",y);break;
   case 12:printf("Dated this 12th day of November,%d",y);break;
   case 13:printf("Dated this 13th day of November,%d",y);break;
   case 14:printf("Dated this 14th day of November,%d",y);break;
   case 15:printf("Dated this 15th day of November,%d",y);break;
   case 16:printf("Dated this 16th day of November,%d",y);break;
   case 17:printf("Dated this 17th day of November,%d",y);break;
   case 18:printf("Dated this 18th day of November,%d",y);break;
   case 19:printf("Dated this 19th day of November,%d",y);break;
   case 20:printf("Dated this 20th day of November,%d",y);break;
   case 21:printf("Dated this 21th day of November,%d",y);break;
   case 22:printf("Dated this 22th day of November,%d",y);break;
   case 23:printf("Dated this 23th day of November,%d",y);break;
   case 24:printf("Dated this 24th day of November,%d",y);break;
   case 25:printf("Dated this 25th day of November,%d",y);break;
   case 26:printf("Dated this 26th day of November,%d",y);break;
   case 27:printf("Dated this 27th day of November,%d",y);break;
   case 28:printf("Dated this 28th day of November,%d",y);break;
   case 29:printf("Dated this 29th day of November,%d",y);break;
   case 30:printf("Dated this 30th day of November,%d",y);break;
   default:printf("Input error!");
   }
  break;
  case 12:
   switch(d){
   case  1:printf("Dated this  1st day of December,%d",y);break;
   case  2:printf("Dated this  2nd day of December,%d",y);break;
   case  3:printf("Dated this  3rd day of December,%d",y);break;
   case  4:printf("Dated this  4th day of December,%d",y);break;
   case  5:printf("Dated this  5th day of December,%d",y);break;
   case  6:printf("Dated this  6th day of December,%d",y);break;
   case  7:printf("Dated this  7th day of December,%d",y);break;
   case  8:printf("Dated this  8th day of December,%d",y);break;
   case  9:printf("Dated this  9th day of December,%d",y);break;
   case 10:printf("Dated this 10th day of December,%d",y);break;
   case 11:printf("Dated this 11th day of December,%d",y);break;
   case 12:printf("Dated this 12th day of December,%d",y);break;
   case 13:printf("Dated this 13th day of December,%d",y);break;
   case 14:printf("Dated this 14th day of December,%d",y);break;
   case 15:printf("Dated this 15th day of December,%d",y);break;
   case 16:printf("Dated this 16th day of December,%d",y);break;
   case 17:printf("Dated this 17th day of December,%d",y);break;
   case 18:printf("Dated this 18th day of December,%d",y);break;
   case 19:printf("Dated this 19th day of December,%d",y);break;
   case 20:printf("Dated this 20th day of December,%d",y);break;
   case 21:printf("Dated this 21th day of December,%d",y);break;
   case 22:printf("Dated this 22th day of December,%d",y);break;
   case 23:printf("Dated this 23th day of December,%d",y);break;
   case 24:printf("Dated this 24th day of December,%d",y);break;
   case 25:printf("Dated this 25th day of December,%d",y);break;
   case 26:printf("Dated this 26th day of December,%d",y);break;
   case 27:printf("Dated this 27th day of December,%d",y);break;
   case 28:printf("Dated this 28th day of December,%d",y);break;
   case 29:printf("Dated this 29th day of December,%d",y);break;
   case 30:printf("Dated this 30th day of December,%d",y);break;
   case 31:printf("Dated this 31th day of December,%d",y);break;
   default:printf("Input error!");
   }
 break;
 default: printf("Input error!");
 }
 } else {
  printf("Input error!\n");
 }
 return 0;
}

wizardTNT 03-01
  • 举报
回复
@赵4老师 谢谢您
赵4老师 02-28
  • 打赏
  • 举报
回复

#include <stdio.h>
#include <stdlib.h>
int main() {
 int m,d,y;
 printf("Enter date (mm/dd/yy) :");
 scanf("%d/%d/%d",&m,&d,&y);
 if (((y%1==0)&&(y>=1))&&((m%1==0)&&(m>=1 && m<=12))&&((d>=1 && d<=31)&&(d%1==0))) {
 switch(m){
  case 1:
   switch(d){
   case  1:printf("Dated this  1st day of January,%d",y);break;
   case  2:printf("Dated this  2nd day of January,%d",y);break;
   case  3:printf("Dated this  3rd day of January,%d",y);break;
   case  4:printf("Dated this  4th day of January,%d",y);break;
   case  5:printf("Dated this  5th day of January,%d",y);break;
   case  6:printf("Dated this  6th day of January,%d",y);break;
   case  7:printf("Dated this  7th day of January,%d",y);break;
   case  8:printf("Dated this  8th day of January,%d",y);break;
   case  9:printf("Dated this  9th day of January,%d",y);break;
   case 10:printf("Dated this 10th day of January,%d",y);break;
   case 11:printf("Dated this 11th day of January,%d",y);break;
   case 12:printf("Dated this 12th day of January,%d",y);break;
   case 13:printf("Dated this 13th day of January,%d",y);break;
   case 14:printf("Dated this 14th day of January,%d",y);break;
   case 15:printf("Dated this 15th day of January,%d",y);break;
   case 16:printf("Dated this 16th day of January,%d",y);break;
   case 17:printf("Dated this 17th day of January,%d",y);break;
   case 18:printf("Dated this 18th day of January,%d",y);break;
   case 19:printf("Dated this 19th day of January,%d",y);break;
   case 20:printf("Dated this 20th day of January,%d",y);break;
   case 21:printf("Dated this 21th day of January,%d",y);break;
   case 22:printf("Dated this 22th day of January,%d",y);break;
   case 23:printf("Dated this 23th day of January,%d",y);break;
   case 24:printf("Dated this 24th day of January,%d",y);break;
   case 25:printf("Dated this 25th day of January,%d",y);break;
   case 26:printf("Dated this 26th day of January,%d",y);break;
   case 27:printf("Dated this 27th day of January,%d",y);break;
   case 28:printf("Dated this 28th day of January,%d",y);break;
   case 29:printf("Dated this 29th day of January,%d",y);break;
   case 30:printf("Dated this 30th day of January,%d",y);break;
   case 31:printf("Dated this 31th day of January,%d",y);break;
   default:printf("Input error!");
   }
  break;
  case 2:
   if ((y%4==0&&y%100!=0) || (y%400==0)) {
    switch(d){
    case  1:printf("Dated this  1st day of February,%d",y);break;
    case  2:printf("Dated this  2nd day of February,%d",y);break;
    case  3:printf("Dated this  3rd day of February,%d",y);break;
    case  4:printf("Dated this  4th day of February,%d",y);break;
    case  5:printf("Dated this  5th day of February,%d",y);break;
    case  6:printf("Dated this  6th day of February,%d",y);break;
    case  7:printf("Dated this  7th day of February,%d",y);break;
    case  8:printf("Dated this  8th day of February,%d",y);break;
    case  9:printf("Dated this  9th day of February,%d",y);break;
    case 10:printf("Dated this 10th day of February,%d",y);break;
    case 11:printf("Dated this 11th day of February,%d",y);break;
    case 12:printf("Dated this 12th day of February,%d",y);break;
    case 13:printf("Dated this 13th day of February,%d",y);break;
    case 14:printf("Dated this 14th day of February,%d",y);break;
    case 15:printf("Dated this 15th day of February,%d",y);break;
    case 16:printf("Dated this 16th day of February,%d",y);break;
    case 17:printf("Dated this 17th day of February,%d",y);break;
    case 18:printf("Dated this 18th day of February,%d",y);break;
    case 19:printf("Dated this 19th day of February,%d",y);break;
    case 20:printf("Dated this 20th day of February,%d",y);break;
    case 21:printf("Dated this 21th day of February,%d",y);break;
    case 22:printf("Dated this 22th day of February,%d",y);break;
    case 23:printf("Dated this 23th day of February,%d",y);break;
    case 24:printf("Dated this 24th day of February,%d",y);break;
    case 25:printf("Dated this 25th day of February,%d",y);break;
    case 26:printf("Dated this 26th day of February,%d",y);break;
    case 27:printf("Dated this 27th day of February,%d",y);break;
    case 28:printf("Dated this 28th day of February,%d",y);break;
    case 29:printf("Dated this 29th day of February,%d",y);break;
    default:printf("Input error!");
    }
   } else {
    switch(d){
    case  1:printf("Dated this  1st day of February,%d",y);break;
    case  2:printf("Dated this  2nd day of February,%d",y);break;
    case  3:printf("Dated this  3rd day of February,%d",y);break;
    case  4:printf("Dated this  4th day of February,%d",y);break;
    case  5:printf("Dated this  5th day of February,%d",y);break;
    case  6:printf("Dated this  6th day of February,%d",y);break;
    case  7:printf("Dated this  7th day of February,%d",y);break;
    case  8:printf("Dated this  8th day of February,%d",y);break;
    case  9:printf("Dated this  9th day of February,%d",y);break;
    case 10:printf("Dated this 10th day of February,%d",y);break;
    case 11:printf("Dated this 11th day of February,%d",y);break;
    case 12:printf("Dated this 12th day of February,%d",y);break;
    case 13:printf("Dated this 13th day of February,%d",y);break;
    case 14:printf("Dated this 14th day of February,%d",y);break;
    case 15:printf("Dated this 15th day of February,%d",y);break;
    case 16:printf("Dated this 16th day of February,%d",y);break;
    case 17:printf("Dated this 17th day of February,%d",y);break;
    case 18:printf("Dated this 18th day of February,%d",y);break;
    case 19:printf("Dated this 19th day of February,%d",y);break;
    case 20:printf("Dated this 20th day of February,%d",y);break;
    case 21:printf("Dated this 21th day of February,%d",y);break;
    case 22:printf("Dated this 22th day of February,%d",y);break;
    case 23:printf("Dated this 23th day of February,%d",y);break;
    case 24:printf("Dated this 24th day of February,%d",y);break;
    case 25:printf("Dated this 25th day of February,%d",y);break;
    case 26:printf("Dated this 26th day of February,%d",y);break;
    case 27:printf("Dated this 27th day of February,%d",y);break;
    case 28:printf("Dated this 28th day of February,%d",y);break;
    default:printf("Input error!");
   }
  }
  break;
  case 3:
   switch(d){
   case  1:printf("Dated this  1st day of March,%d",y);break;
   case  2:printf("Dated this  2nd day of March,%d",y);break;
   case  3:printf("Dated this  3rd day of March,%d",y);break;
   case  4:printf("Dated this  4th day of March,%d",y);break;
   case  5:printf("Dated this  5th day of March,%d",y);break;
   case  6:printf("Dated this  6th day of March,%d",y);break;
   case  7:printf("Dated this  7th day of March,%d",y);break;
   case  8:printf("Dated this  8th day of March,%d",y);break;
   case  9:printf("Dated this  9th day of March,%d",y);break;
   case 10:printf("Dated this 10th day of March,%d",y);break;
   case 11:printf("Dated this 11th day of March,%d",y);break;
   case 12:printf("Dated this 12th day of March,%d",y);break;
   case 13:printf("Dated this 13th day of March,%d",y);break;
   case 14:printf("Dated this 14th day of March,%d",y);break;
   case 15:printf("Dated this 15th day of March,%d",y);break;
   case 16:printf("Dated this 16th day of March,%d",y);break;
   case 17:printf("Dated this 17th day of March,%d",y);break;
   case 18:printf("Dated this 18th day of March,%d",y);break;
   case 19:printf("Dated this 19th day of March,%d",y);break;
   case 20:printf("Dated this 20th day of March,%d",y);break;
   case 21:printf("Dated this 21th day of March,%d",y);break;
   case 22:printf("Dated this 22th day of March,%d",y);break;
   case 23:printf("Dated this 23th day of March,%d",y);break;
   case 24:printf("Dated this 24th day of March,%d",y);break;
   case 25:printf("Dated this 25th day of March,%d",y);break;
   case 26:printf("Dated this 26th day of March,%d",y);break;
   case 27:printf("Dated this 27th day of March,%d",y);break;
   case 28:printf("Dated this 28th day of March,%d",y);break;
   case 29:printf("Dated this 29th day of March,%d",y);break;
   case 30:printf("Dated this 30th day of March,%d",y);break;
   case 31:printf("Dated this 31th day of March,%d",y);break;
   default:printf("Input error!");
   }
  break;
  case 4:
   switch(d){
   case  1:printf("Dated this  1st day of April,%d",y);break;
   case  2:printf("Dated this  2nd day of April,%d",y);break;
   case  3:printf("Dated this  3rd day of April,%d",y);break;
   case  4:printf("Dated this  4th day of April,%d",y);break;
   case  5:printf("Dated this  5th day of April,%d",y);break;
   case  6:printf("Dated this  6th day of April,%d",y);break;
   case  7:printf("Dated this  7th day of April,%d",y);break;
   case  8:printf("Dated this  8th day of April,%d",y);break;
   case  9:printf("Dated this  9th day of April,%d",y);break;
   case 10:printf("Dated this 10th day of April,%d",y);break;
   case 11:printf("Dated this 11th day of April,%d",y);break;
   case 12:printf("Dated this 12th day of April,%d",y);break;
   case 13:printf("Dated this 13th day of April,%d",y);break;
   case 14:printf("Dated this 14th day of April,%d",y);break;
   case 15:printf("Dated this 15th day of April,%d",y);break;
   case 16:printf("Dated this 16th day of April,%d",y);break;
   case 17:printf("Dated this 17th day of April,%d",y);break;
   case 18:printf("Dated this 18th day of April,%d",y);break;
   case 19:printf("Dated this 19th day of April,%d",y);break;
   case 20:printf("Dated this 20th day of April,%d",y);break;
   case 21:printf("Dated this 21th day of April,%d",y);break;
   case 22:printf("Dated this 22th day of April,%d",y);break;
   case 23:printf("Dated this 23th day of April,%d",y);break;
   case 24:printf("Dated this 24th day of April,%d",y);break;
   case 25:printf("Dated this 25th day of April,%d",y);break;
   case 26:printf("Dated this 26th day of April,%d",y);break;
   case 27:printf("Dated this 27th day of April,%d",y);break;
   case 28:printf("Dated this 28th day of April,%d",y);break;
   case 29:printf("Dated this 29th day of April,%d",y);break;
   case 30:printf("Dated this 30th day of April,%d",y);break;
   default:printf("Input error!");
   }
  break;
  case 5:
   switch(d){
   case  1:printf("Dated this  1st day of May,%d",y);break;
   case  2:printf("Dated this  2nd day of May,%d",y);break;
   case  3:printf("Dated this  3rd day of May,%d",y);break;
   case  4:printf("Dated this  4th day of May,%d",y);break;
   case  5:printf("Dated this  5th day of May,%d",y);break;
   case  6:printf("Dated this  6th day of May,%d",y);break;
   case  7:printf("Dated this  7th day of May,%d",y);break;
   case  8:printf("Dated this  8th day of May,%d",y);break;
   case  9:printf("Dated this  9th day of May,%d",y);break;
   case 10:printf("Dated this 10th day of May,%d",y);break;
   case 11:printf("Dated this 11th day of May,%d",y);break;
   case 12:printf("Dated this 12th day of May,%d",y);break;
   case 13:printf("Dated this 13th day of May,%d",y);break;
   case 14:printf("Dated this 14th day of May,%d",y);break;
   case 15:printf("Dated this 15th day of May,%d",y);break;
   case 16:printf("Dated this 16th day of May,%d",y);break;
   case 17:printf("Dated this 17th day of May,%d",y);break;
   case 18:printf("Dated this 18th day of May,%d",y);break;
   case 19:printf("Dated this 19th day of May,%d",y);break;
   case 20:printf("Dated this 20th day of May,%d",y);break;
   case 21:printf("Dated this 21th day of May,%d",y);break;
   case 22:printf("Dated this 22th day of May,%d",y);break;
   case 23:printf("Dated this 23th day of May,%d",y);break;
   case 24:printf("Dated this 24th day of May,%d",y);break;
   case 25:printf("Dated this 25th day of May,%d",y);break;
   case 26:printf("Dated this 26th day of May,%d",y);break;
   case 27:printf("Dated this 27th day of May,%d",y);break;
   case 28:printf("Dated this 28th day of May,%d",y);break;
   case 29:printf("Dated this 29th day of May,%d",y);break;
   case 30:printf("Dated this 30th day of May,%d",y);break;
   case 31:printf("Dated this 31th day of May,%d",y);break;
   default:printf("Input error!");
   }
  break;
//未完待续
  • 举报
回复 1
@赵4老师 看到你们的代码,想起30年前刚学basic时,一个5数字冒泡排序,没用循环生生写了121行。。。记忆尤新
zara 02-28
  • 打赏
  • 举报
回复

什么题目写成了这样的源码?
switch(b) 没大括号? if ... case 2 ... else case 2 这样是不对的,除非是 #if 条件编译

wizardTNT 03-01
  • 举报
回复
@zara 在完成学校的题,我是初学者很多地方不懂,谢谢提醒
发帖
C++ 语言

6.3w+

社区成员

C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
帖子事件
创建了帖子
2023-02-27 20:40
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下