Skip to content

Instantly share code, notes, and snippets.

/basic.c Secret
Created Jun 30, 2016

What would you like to do?
#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
You can’t perform that action at this time.