Skip to content

Instantly share code, notes, and snippets.

/basic.c Secret

Created June 30, 2016 10:45
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 anonymous/25d1ed63c5d0875330737bd24899c6d3 to your computer and use it in GitHub Desktop.
Save anonymous/25d1ed63c5d0875330737bd24899c6d3 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
//provided input
char* input = "12\n····\nVAR I\n·FOR I=1 TO 31\n»»»»IF !(I MOD 3) THEN\n··PRINT \"FIZZ\"\n··»»ENDIF\n»»»»····IF !(I MOD 5) THEN\n»»»»··PRINT \"BUZZ\"\n··»»»»»»ENDIF\n»»»»IF (I MOD 3) && (I MOD 5) THEN\n······PRINT \"FIZZBUZZ\"\n··»»ENDIF\n»»»»·NEXT";
int main(void)
{
printf("INPUT:\n\n%s\n\n", input);
int i;
//int j;
//int tabcounter = 0;
int outputcounter = 0;
char* output[250];
//loop through entire string once to remove all the dots and arrows
for (i=0; i < strlen(input); i++)
{
//begin at first letter
if (isalpha(input[i]) == 0)
{
//ignore all · and » and put into a new string output
if (input[i] != ("·" || "»"))
{
output[outputcounter] = &input[i];
printf("%s\n", output[outputcounter]);
outputcounter = outputcounter + 1;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment