-
-
Save anonymous/25d1ed63c5d0875330737bd24899c6d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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