Skip to content

Instantly share code, notes, and snippets.

@giuscri
Last active December 24, 2015 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giuscri/6741962 to your computer and use it in GitHub Desktop.
Save giuscri/6741962 to your computer and use it in GitHub Desktop.
Portion of a code that was broken
// That sounds working
// ...
// ...
if (y1 > y2)
printf("Date %2.2d/%2.2d/%2.2d is earlier.\n",d2,m2,y2);
else if (y1 == y2) {
if (m1 > m2)
printf("Date %2.2d/%2.2d/%2.2d is earlier.\n",d2,m2,y2);
else if (m1 < m2)
printf("Date %2.2d/%2.2d/%2.2d is earlier.\n",d1,m1,y1);
else {
if (d1 > d2)
printf("Date %2.2d/%2.2d/%2.2d is earlier.\n",d2,m2,y2);
else if (d1 < d2)
printf("Date %2.2d/%2.2d/%2.2d is earlier.\n",d1,m1,y1);
else
printf("Dates are the same.\n");
}
}
else
printf("Date %2d/%2d/%2d is earlier.\n",d1,m1,y1);
// ...
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment