All pastes #2131663 Raw Edit

Miscellany

public c v1 · immutable
#2131663 ·published 2012-03-23 21:26 UTC
rendered paste body
#include <stdio.h>#include <time.h>int main(){	time_t rawtime;	struct tm *timeinfo;	time(&rawtime);	timeinfo = localtime(&rawtime);	int day = timeinfo->tm_mday;	int month = timeinfo->tm_mon + 1;	int year = timeinfo->tm_year + 1900;	int age = year - 1988;	char *suffix;	if (age % 10 == 1 && age != 11)	{		suffix = (char *)"st";	}	else if (age % 10 == 2 && age != 12)	{		suffix = (char *)"nd";	}	else if (age % 10 == 3 && age != 13)	{		suffix = (char *)"rd";	}	else	{		suffix = (char *)"th";	}	if (month == 3 && day == 23)	{		printf("Happy %d%s Birthday, Aaron!\n", age, suffix);	}	else	{		printf("It's not your birthday...\n");	}}