Skip to content

Instantly share code, notes, and snippets.

@ReaperUnreal
Created October 17, 2012 18:30
Show Gist options
  • Save ReaperUnreal/3907218 to your computer and use it in GitHub Desktop.
Save ReaperUnreal/3907218 to your computer and use it in GitHub Desktop.
fizzbuzz++
void fizzbuzz(int n)
{
static bool firstRun = true;
if(firstRun)
{
std::sort(table);
firstRun = false;
}
char buffer[MAX_CHAR];
buffer[0] = '\0';
for(int r in table.keys())
{
if(n % r == 0)
strcat(buffer, table[r]);
}
if(buffer[0] == '\0')
sprintf(buffer, "%d", n);
printf("%s\n", buffer);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment