Skip to content

Instantly share code, notes, and snippets.

@3a4oT
Last active January 31, 2016 16:00
Show Gist options
  • Save 3a4oT/5ecdc7cd7fe85977bffb to your computer and use it in GitHub Desktop.
Save 3a4oT/5ecdc7cd7fe85977bffb to your computer and use it in GitHub Desktop.
Happy Birthday! Hand made present.
//
// main.c
// Wishes
//
// Created by Petro Rovenskyy on 1/31/16.
// Copyright © 2016 Petro Rovenskyy. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
typedef struct Developer {
char* name;
char* title;
char* company;
char* birthDayDate;
} Developer;
const char *wishes[] = {
"LIFE where FUN == true",
"MOTIVATION where NEVER_GET_DOWN == true",
"GYM where GO_HARD_OR_GO_HOME == true",
"GIRLS WHERE (.)(.) >= 3 AND weight / POW(height , 2)BETWEEN 18 AND 21 ORDER BY age",
"LIFE where WISDOM == '~'"
};
void displayWishes(Developer *dev, const char* (*getWishes)(void)) {
printf("Dear %s, I know that you are %s at %s and %s is your birthday. I want to wish you :\n %s \n",
dev->name,
dev->title,
dev->company,
dev->birthDayDate,
getWishes());
}
const char* randomWishes(void) {
const size_t wishes_count = sizeof(wishes) / sizeof(wishes[0]);
const char *randomWish = wishes[random() % wishes_count];
return randomWish;
}
int main(int argc, const char * argv[]) {
Developer d = { "Oleg",
"FrontEnd Developer",
"HotSchedules",
"31.01"
};
displayWishes(&d, randomWishes);
return 0;
}
@3a4oT
Copy link
Author

3a4oT commented Jan 31, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment