Created
December 23, 2016 22:33
-
-
Save algorev/0dbea29d9cc9f0e0a7925b928871e36b 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 "varcode.h" | |
int main() | |
{ | |
int timetick = 0; | |
int result = 0; | |
char command[3] = {'o','\0'}; | |
printf("VarCode v1.0, by Spooikypok_Dev"); | |
while(command[0] != 'e') | |
{ | |
printf("\n>"); | |
fgets(command,3,stdin); | |
command[2] = '\0'; | |
switch(command[0]) | |
{ | |
case 'i': | |
result++; | |
break; | |
case 'd': | |
result--; | |
break; | |
case 's': | |
result *= result; | |
break; | |
case 'o': | |
printf("%d", result); | |
break; | |
case 'e': | |
break; | |
case 'z': | |
result = 0; | |
break; | |
case 'p': | |
timetick = time(NULL); | |
while(time(NULL) < timetick + 1); | |
break; | |
case '\n': | |
break; | |
default: | |
printf("invalid command: %c", command[0]); | |
break; | |
} | |
} | |
return 0; | |
} |
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 <stdlib.h> | |
#include <string.h> | |
#include <time.h> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment